Reputation: 2042
In my project I use UIManagedDocument with CoreData and iCloud. There seems to be lots of bugs when creating a UIManagedDocument in iCloud - especially when there is no network service.
But now I get some strange errors/app crash with network service (also with wifi) when saving the document for creation:
-[PFUbiquitySetupAssistant validateOptionsWithError:](262): CoreData: Ubiquity: Error attempting to read ubiquity root url: file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/.
Error: Error Domain=LibrarianErrorDomain Code=1 "The operation couldn’t be completed. (LibrarianErrorDomain error 1 - Unable to initiate item download.)" UserInfo=0x1f56d140 {NSURL=file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/, NSUnderlyingError=0x1d89b4a0 "The operation couldn’t be completed. (UBErrorDomain error 0.)", NSDescription=Unable to initiate item download.}
userInfo: {
NSDescription = "Unable to initiate item download.";
NSURL = "file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/";
NSUnderlyingError = "Error Domain=UBErrorDomain Code=0 \"The operation couldn\U2019t be completed. (UBErrorDomain error 0.)\"";
}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'
*** First throw call stack:
It says that a download operation from the transaction log folder couldn't be completed. I can't understand this as the app should create a document and not download anything.
btw the iCloud folder for the app is empty!
Deleting the iCloud account from device and logging in again didn't help too. The device is a iPhone 4S running iOS 6.
Anyone made similar experiences?
EDIT:
Now, after some hundrets of deletions and rebuilds I get a different error on the same device:
-[PFUbiquitySafeSaveFile waitForFileToUpload:](268): CoreData: Ubiquity: <PFUbiquityPeerReceipt: ...>(0)
permanentLocation: <PFUbiquityLocation: ...>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/mobile.XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Document/Q0_AoYZV8MTbAihmdWBiEFhxmCgziT9RyrvylTHgQP4=/receipt.0.cdt
safeLocation: <PFUbiquityLocation: ...>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/mobile.XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Document/Q0_AoYZV8MTbAihmdWBiEFhxmCgziT9RyrvylTHgQP4=/mobile.XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.0.cdt
currentLocation: <PFUbiquityLocation: ...>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~companyname~AppName/TransactionsFolder/mobile.XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Document/Q0_AoYZV8MTbAihmdWBiEFhxmCgziT9RyrvylTHgQP4=/mobile.XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.0.cdt
kv: (null)
Safe save failed for file, error: Error Domain=NSCocoaErrorDomain Code=512 "The file upload timed out." UserInfo=0x1de36dc0 {NSLocalizedDescription=The file upload timed out.}
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'
*** First throw call stack:
Somehow it seems like the device has no access to iCloud service even though it gets a iCloud token and reachability is fine...
Upvotes: 0
Views: 837
Reputation: 4516
I know this is old, but I have been chasing a similar problem and perhaps the following will help others:
In my case I get this after deleting iCould data and the app under development and rebuilding from scratch. A full shutdown and restart of the device seems to fix it - not sure why and perhaps Timbo's 'Reset All Settings' does the same thing - but this way you don't lose other app settings as well.
Ali
Upvotes: 0
Reputation: 1214
If you have a device that is refusing to synchronize after you have reset its iCloud data, try resetting all settings via Settings > General > Reset All Settings. This approach won’t delete any application data, and can resolve the “Error attempting to read ubiquity root url” error message.
Upvotes: 0
Reputation: 70936
Yes, I've had very similar experiences. These are internal bugs in Core Data's iCloud integration. They don't mean that you did anything wrong, and there's nothing you can do in code to fix them. You're right-- you aren't downloading anything in your code, but Core Data is trying to do so, behind the scenes, and failing. This is completely out of your control.
The first errors say that the framework was unable to download existing transaction files. There might not be any, but it can't even tell. The second error says that it was unable to create any new transaction files. You're right-- you have no access to iCloud, even though the API says that you do.
You might be able to get things working again by finding your app in Settings --> iCloud and deleting any data there, deleting your app from the device, sacrificing a chicken, and trying again. But the problem comes back. File bugs with Apple and hope that it gets fixed.
Upvotes: 1