I am trying to copy files that I add to a folder called "includes" to a folder on documents directory called also "includes".
I get a nil value for resContents
. Why?
- (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);;
}
}
}