如何解决iphone5 iPhone图书管理员[12461]中的问题<;错误>;:无法下载file://localhost/private..when 使用coredata和icloud?

如何解决iphone5 iPhone图书管理员[12461]中的问题<;错误>;:无法下载file://localhost/private..when 使用coredata和icloud?,iphone,core-data,ios6,ios4,icloud,Iphone,Core Data,Ios6,Ios4,Icloud,我正在我的应用程序中使用coredata和icloud。当我在iCloud上创建UIManagedDocument并在iPhone5以外的设备上调试应用程序时,它工作正常。但在iPhone上调试时会出现如下错误: -(void)saveManagegDocument { if(iCloud) { NSError * error = nil; [coordinator coordinateWritingItemAtURL:managedDoc.fileUR

我正在我的应用程序中使用coredata和icloud。当我在iCloud上创建UIManagedDocument并在iPhone5以外的设备上调试应用程序时,它工作正常。但在iPhone上调试时会出现如下错误:

-(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 ");
        }
    }];
}
Jun 26 15:49:49 Kumar iPhone图书管理员[12461]:无法下载file://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258L~com~leaf~Journal/COREDATABASE/(0x80000000000000):操作无法完成。(UBErrorDomain错误0。) ��Jun 26 15:49:58 Kumar iPhone图书管理员[12461]:无法下载file://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258Lh~com~leaf~Journal/Logs/(0x80000000000000):操作无法完成。(UBErrorDomain错误0。) ��6月26日15:49:58 Kumar iPhone Journal[12554]:-pUbiquityImportScanOperation main:CoreData:Ubiquity: 无法获取根路径(0)的子路径:/private/var/mobile/Library/mobile Documents/3JPA4W258L~com~leaf~Journal/Logs 错误:(空) userInfo:(空) ��6月26日15:49:58 Kumar iPhone Journal[12554]:-NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error::CoreData:Ubiquity:设置Ubiquity集成时出错:(null)

代码如下:

-(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 ");
        }
    }];
}
所以,如果有,请写下答案


谢谢。

这些是iCloud+核心数据内部错误。他们并不意味着你做错了什么,也没有什么可以改变的,让它更好地工作。有时候iCloud就是这么做的,有时候只是在一台设备上,有时候是随机在不同的设备上。你唯一的选择就是稍后再试,希望有更好的结果


我知道这不是任何人想要的答案,但现在核心数据和iCloud就是这样。文件错误,或者尝试iOS 7,看看是否更好。

Tom Harrington,如果有任何关于您答案的苹果文档,请与我分享。