在xcode8.3中,iOS10我正在尝试将文件从包装目录复制到应用程序专用目录。这对ios6效果很好,但在ios8及以上。
i是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及向上阻止它?
此代码实际作品!我不确定Xcode 8.3是否具有文件大小限制。