Core data/iCloud seeding with local xml file throw

2020-07-08 06:30发布

问题:

Hopefully this is something simple but I haven't been able to track down a fix yet. I have an application that I'm trying to implement both iCloud and Core Data with. I'd like it to run on iOS7 and iOS8.

The application is a checklist/tableview application for collectibles.

Essentially, the application has an pre-seeded xml file with about 50,000 in it. The sqlite/core data is initially configured to have just 1 item. Users can, from a table view, select groups to add to the core data store (so that not all 50,000 items are included). When the user selects a group that has 1-50 items, it parses the xml for those items and writes them into the core data store. When a user selects a group that has a larger amount of files, it parses and adds them, but then also throws some random "no document at url" errors during the parsing process. The application doesn't crash, and all items seem to be added, but the application stops synching with iCloud. The exact error is:

__45-[PFUbiquityFilePresenter processPendingURLs]_block_invoke(439): CoreData: Ubiquity:  
Librarian returned a serious error for starting downloads Error Domain=BRCloudDocsErrorDomain Code=5 
"The operation couldn’t be completed. (BRCloudDocsErrorDomain error 5 - No document at URL)" 
UserInfo=0x7fd7f54abea0 {NSDescription=No document at URL, 
NSFilePath=/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-      0D52D833E28A/data/Library/Mobile    Documents/iCloud~com~xxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/C45FA553-6CA0-4C26-845B-B478EF7EAD60.1.cdt, 
NSUnderlyingError=0x7fd7f54aa200 "The operation couldn’t be completed. No such file or directory"} 
with userInfo {
NSDescription = "No document at URL";
NSFilePath = "/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/C45FA553-6CA0-4C26-845B-B478EF7EAD60.1.cdt";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. 
No such file or directory\" UserInfo=0x7fd7f5433240 {NSDescription=No such file or directory}";
} for these urls: (
"file:///Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile%20Documents/iCloud~com~xxxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/C45FA553-6CA0-4C26-845B-B478EF7EAD60.1.cdt"
)

Then I will get a "move" error as well (sometimes after the parse is complete):

[PFUbiquityTransactionLog moveFileToPermanentLocationWithError:](761): CoreData: Ubiquity:  
CoreData: Ubiquity: Error writing export log to file: file:///Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile%20Documents/iCloud~com~xxxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt
error: Error Domain=NSCocoaErrorDomain Code=516 "The operation couldn’t be completed. (Cocoa error 516.)" 
UserInfo=0x7fd7f49cdfd0 {NSSourceFilePathErrorKey=/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxx~xxxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/tempLogs.nosync/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt, 
NSUserStringVariant=(
Move
), NSDestinationFilePath=/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt, 
NSFilePath=/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxx~xxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/tempLogs.nosync/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt, 
NSUnderlyingError=0x7fd7f497f430 "The operation couldn’t be completed. File exists"}
userInfo: {
NSDestinationFilePath = "/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxx~xxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt";
NSFilePath = "/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/tempLogs.nosync/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt";
NSSourceFilePathErrorKey = "/Users/zacharyfisher/Library/Developer/CoreSimulator/Devices/4B70FCFC-4704-4C83-B848-0D52D833E28A/data/Library/Mobile Documents/iCloud~com~xxxxxxx~xxxxxxx/CoreData/iCloud/nobody~sim43DA22C4-427B-5FCD-9B61-90CE79638F6B/tempLogs.nosync/iCloud/PZbSJk1f2RNB6ucDj0Y6VqL1KgXYAxi4LcApXONjvnQ=/ABE37211-02B7-4F20-B631-B5D91B23E9BE.1.cdt";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=17 \"The operation couldn\U2019t be completed. File exists\"";
NSUserStringVariant =     (
    Move
);

}

Any thoughts on how to fix this? Am I trying to make too many changes at once and that is crashing the core data/icloud synching? Any thoughts or pointers would be appreciated.

Zack

回答1:

Zack, this isn't an answer (I don't have the rep to comment), but it might help you get on the right track. I'm implementing iCloud core data and am running into what looks like the same problem with iOS 8... same "No document at URL" error (no move error for me), and same breakdown in data sync. Two observations:

  • When I am running my app on two devices, core data sync initially works very well... like for a few minutes and a few updates. Then I get the "no document at URL" error.

  • My .sqlite database is very small and the updates I'm trying to make are modest (e.g. adding a single new entity), so I don't think file sizes or update complexity are factors.

  • On the device where these errors are logging, the store stops importing changes from iCloud. But changes I make on that device do continue to persist to the other device. So the effect is like a one-way breakdown.

Hope this helps. Would appreciate posts on any progress you make. I've been wrestling with this for several weeks and am close to giving up and shipping the app (which is universal) without iCloud data sync.