2010-10-29 166 views
0

我正在最困難的時間才能正常工作。我試圖將我的包中的文件夾複製到文檔目錄。iphone將文件夾從文件夾複製到文檔

我試圖找到該文件夾​​是在這裏:

...應用程序/資源/ 12 /(一堆的JPG文件的)

NSString *myPath = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:@"12"]; 
NSLog(@"%@",myPath);/// returns "..../MyApp.app/12" 

NSArray *arrayOf12s = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:myPath error:nil]; 

NSLog(@"%@",arrayOf12s);  ////always returns NULL 

回答

2

如何在-contentsOfDirectoryAtPath使用NSError參數:錯誤:打電話?

NSString *myPath = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:@"12"]; 
NSLog(@"%@",myPath);/// returns "..../MyApp/12" 

NSError *error = nil; 
NSArray *arrayOf12s = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:resourceDBFolderPath error:&error]; 

if (error) 
    NSLog(@"Error: %@", [error localizedDescription]); 

NSLog(@"%@",arrayOf12s);  ////always returns NULL 

它可能照到造成一定的光...

+0

一切都是爲了給是:錯誤:操作無法完成。 (可可錯誤260.) – Brodie 2010-10-29 16:52:40

+0

什麼是'resourceDBFolderPath'設置爲? – westsider 2010-10-29 17:02:02

+0

另外,你見過這個?它可能有助於將整個目錄包含到應用程序包中 - 而不僅僅是目錄的內容。 – westsider 2010-10-29 17:08:04

相關問題