簡體   English   中英

iPhone將文件夾從文件夾復制到文檔

[英]iphone copying folder from bundle to documents

我最困難的是讓它工作。 我正在嘗試將文件夾從捆綁包復制到文檔目錄。

我要查找的文件夾在這里:

... 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

如何在-contentsOfDirectoryAtPath:error:調用中使用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

它可能會說明原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM