2010-05-01 65 views
0

我使用負載的plist這是在我的主束(的ressource文件夾)到一個數組使用:負載陣列

NSString *path = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:nomPlist ]; 
NSMutableArray *tmpQuestion = [[NSArray alloc] initWithContentsOfFile:path]; 
arrayQuestion = [ [NSArray alloc] initWithArray:tmpQuestion]; 
[tmpQuestion release]; 

因爲我決定改變我的plist和主要的內容bundle是隻讀的我怎麼能讓這個數組從我的應用程序的Documents目錄加載plist? ?

感謝所有

回答

0

[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]]將讓你您的應用程序的Documents目錄。首次啓動時,使用NSFileManager將plist文件從您的應用程序包複製到文檔目錄。之後,請始終打開它。

0

嘗試看看,如果在應用程序的文件目錄中的文件存在

  • YES:然後使用此文件
  • NO:這是第一個推出的,所以從應用程序的複製捆綁