Jau*_*me 11 iphone xcode cocoa-touch objective-c ios
我正在尝试将我添加到名为"includes"的文件夹中的文件复制到名为"includes"的文档目录中的文件夹中.
我得到一个零值resContents.为什么?
- (void)copyResources{
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"includes"];
NSString *destPath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"includes"];
NSArray* resContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:sourcePath error:NULL];
for (NSString* obj in resContents){
NSError* error;
if (![[NSFileManager defaultManager] copyItemAtPath:[sourcePath stringByAppendingPathComponent:obj] toPath:[destPath stringByAppendingPathComponent:obj] error:&error]) {
NSLog(@"Error: %@", error);;
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7216 次 |
| 最近记录: |