2017-04-24 69 views
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和攔截呢?

+0

你在控制檯上得到的值是什麼?你有沒有檢查錯誤指針? –

+0

@MidhunMP我會檢查並讓你知道.. – user914425

回答

0

此代碼實際工作!我不確定Xcode 8.3是否具有文件大小限制。

相關問題