0
在Xcode8.3 for iOS10中,我试图将文件从软件包目录复制到应用程序专用目录。这对iOS6起到了很好的作用,但在iOS8以上并没有起作用。Xcode8.3 iOS10将文件从软件包复制到应用程序目录
我是索引文件在for循环中:
NSString* currentfilename = [[dbfileManager directoryContentsAtPath: bundleFolderPath] objectAtIndex:i];
NSString*s =[NSString stringWithFormat:@".db"];
//NSLog(@"getAllMapDBFileNames db file exist=%@",s);
if ([currentfilename rangeOfString:s].location != NSNotFound){
NSString *tmpfilename=[[[currentfilename stringByReplacingOccurrencesOfString:@"-" withString:@" "] stringByReplacingOccurrencesOfString:@".db" withString:@""] capitalizedString];
NSString *strdestination = [NSString stringWithFormat:@"%@/%@", bundleFolderPath,currentfilename];
NSLog(@"DOES Exist! = %@",tmpfilename);
NSLog(@"strdestination = %@",strdestination);
NSString *toPath = [NSString stringWithFormat:@"%@/%@", dbappFolderPath,currentfilename];
NSLog(@"toPath = %@",toPath);
[[NSFileManager defaultManager]copyItemAtPath:strdestination toPath:toPath error:NULL]; //&Error
}
为什么iOS的8和拦截呢?
你在控制台上得到的值是什么?你有没有检查错误指针? –
@MidhunMP我会检查并让你知道.. – user914425