So I was migrating my Core Data to UIManagedDocument.
Calling openWithCompletionHandler on iPhone simulator works fine, but when I try to run my project on a real device it always returns NO. I override handleError and that's what I get:
Error Domain=NSCocoaErrorDomain Code=260
"The operation couldn’t be completed. (Cocoa error 260.)"
UserInfo=0x1edafa90 {path=file://localhost/var/mobile/Applications/D57D7EAC-6E92-4CAD-97E7-179010CB6738/Project%20APP.app/DataModel.momd/StoreContent.nosync, NSUnderlyingError=0x1ed8e160
"The operation couldn’t be completed. (Cocoa error 513.)", reason=Unable to restore path to store content}
And that's how I call it:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: PrivateName, NSPersistentStoreUbiquitousContentNameKey, // cloudURL, NSPersistentStoreUbiquitousContentURLKey, [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; [self setPersistentStoreOptions:options]; [self openWithCompletionHandler:^(BOOL success) { if (success) NSLog(@"opened"); else { NSLog(@"Not opened"); } }];