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