我在我的應用程序中使用了coredata和icloud。當我在iCloud上創建UIManagedDocument並在除iPhone5以外的設備上調試應用程序時,它工作正常。但在iPhone上進行調試時出現如下錯誤:如何解決iphone5 iPhone librariand問題[12461] <Error>:無法下載file://localhost/private..when使用coredata和icloud?
Jun 26 15:49:49 Kumar-iPhone librariand [12461]:無法下載file:// localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258L〜com〜leaf〜Journal/COREDATABASE /(0x8000000000000000):操作無法完成。 (UBErrorDomain error 0.) Jun 26 15:49:58 Kumar-iPhone librariand [12461]:無法下載file:// localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258Lh〜com〜leaf 〜Journal/Logs /(0x8000000000000000):操作無法完成。 (UBErrorDomain error 0.) Jun 26 15:49:58 Kumar-iPhone日記本[12554]:-PFUbiquityImportScanOperation main:CoreData:Ubiquity: 無法獲取根路徑(0)的子路徑:/ private/var/mobile (null) userInfo:(null) Jun 26 15:49:58 Kumar-iPhone日記本[12554]:-NSPersistentStoreCoordinator addPersistentStoreWithType:配置文件/庫/移動文檔/日誌/日誌 :網址:選項:錯誤:: CoreData:無處不在:在設置無處不在整合時出現錯誤:(空)
的代碼如下:
-(void)saveManagegDocument {
if(iCloud) {
NSError * error = nil;
[coordinator coordinateWritingItemAtURL:managedDoc.fileURL options:NSFileCoordinatorWritingForDeleting error:&error byAccessor:^(NSURL *newURL) {
NSError * delError = nil;
[[NSFileManager defaultManager] removeItemAtURL:newURL error:&delError];
//if(delError)
//NSLog(@"Error deleting data file .... , reason : %@",delError.localizedDescription);
}];
NSError * logerror = nil;
[coordinator coordinateWritingItemAtURL:[managedDoc.persistentStoreOptions valueForKey:NSPersistentStoreUbiquitousContentURLKey] options:NSFileCoordinatorWritingForDeleting error:&logerror byAccessor:^(NSURL *newURL) {
NSError * delError = nil;
[[NSFileManager defaultManager] removeItemAtURL:newURL error:&delError];
//if(delError)
//NSLog(@"Error deleting transaction file .... , reason : %@",delError.localizedDescription);
}];
}
[managedDoc saveToURL:managedDoc.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
if (success) {
[managedDoc closeWithCompletionHandler:^(BOOL success) {
[managedDoc openWithCompletionHandler:^(BOOL success) {
[self performSelectorOnMainThread:@selector(documentReady) withObject:nil waitUntilDone:NO];
}];
}];
} else {
[[[UIAlertView alloc] initWithTitle:@"Could not save or open core data database." message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
// [self showMessage:@"Could not save or open core data database "];
//NSLog(@"Could not save or open core data database ");
}
}];
}
那麼,如果有,請寫出答案?
謝謝。
湯姆哈靈頓,如果任何有關你的答案的蘋果文件可用,請與我分享。 – URathore
這些錯誤沒有記錄。 –