0

私はこれを機能させるのに最も苦労しています。バンドルからドキュメントディレクトリにフォルダをコピーしようとしています。

私が見つけようとしているフォルダはここにあります:

... app / Resources / 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
4

1 に答える 1

2

-contentsOfDirectoryAtPath:error:callで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

原因に光を当てるかもしれません...

于 2010-10-29T16:22:51.543 に答える