简体   繁体   中英

How to fix the issue in iphone5 iPhone librariand[12461] <Error>: unable to download file://localhost/private..when using coredata and icloud?

I am using the coredata and icloud in my app. When i created the UIManagedDocument on iCloud and debugging the app on device other than iPhone5, it's working fine. But when debugging on iPhone it gives the error as given below:

Jun 26 15:49:49 Kumar-iPhone librariand[12461] : unable to download file://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258L~com~leaf~Journal/COREDATABASE/ (0x8000000000000000): The operation couldn't be completed. (UBErrorDomain error 0.) Jun 26 15:49:58 Kumar-iPhone librariand[12461] : unable to download file://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258Lh~com~leaf~Journal/Logs/ (0x8000000000000000): The operation couldn't be completed. (UBErrorDomain error 0.) Jun 26 15:49:58 Kumar-iPhone Journal[12554] : -PFUbiquityImportScanOperation main: CoreData: Ubiquity: Unable to get subpaths of root path (0): /private/var/mobile/Library/Mobile Documents/3JPA4W258L~com~leaf~Journal/Logs Error: (null) userInfo: (null) Jun 26 15:49:58 Kumar-iPhone Journal[12554] : -NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:: CoreData: Ubiquity: An error occurred while setting up the ubiquity integration: (null)

The code is given below:

-(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 ");
        }
    }];
}

So, Please write the answer if you have?

Thanks.

Those are internal iCloud + Core Data errors. They don't mean you did anything wrong, and there's nothing you can change to make it work better. Sometimes iCloud just does that, sometimes just on one device, sometimes randomly on different devices. Your only alternative is to try again later and hope for better results.

I know that's not the answer anyone wants, but that's how it is with Core Data and iCloud right now. File bugs, or try with iOS 7 and see if it's better there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM