Using iCloud Core Data syncing results in many errors

Originator:mb
Number:rdar://10270767 Date Originated:
Status:Closed Resolved:
Product: Product Version:
Classification: Reproducible:
 
11-Oct-2011 11:19 PM Matt Bischoff:
'iPhoneCoreDataRecipes.zip' was successfully uploaded

11-Oct-2011 11:19 PM Matt Bischoff:
Summary:

When using Core Data's ubiquitous persistent stores as outlined in the iPhoneCoreDataRecipes sample code, many errors are printed to the log including: "Couldn't open transaction log at URL".

Steps to Reproduce:

1. Install the iPhoneCoreDataRecipes sample code on 3 devices.
2. Add and delete items quickly on all three devices while connected to the debugger.
3. Watch the console log.

Expected Results:

iCloud syncing occurs in the background.

Actual Results:

The following errors are printed and syncing may fail.

2011-10-10 15:02:26.626 Recipes[2208:3503] +[PFUbiquityTransactionLog loadPlistAtLocation:withError:](324): CoreData: Ubiquity:  Encountered an error trying to open the log file at the location: <PFUbiquityLocation: 0x1993c0>: /private/var/mobile/Library/Mobile Documents/ ...
Error: Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256 - The item failed to download.)"
...
2011-10-10 15:02:26.640 Recipes[2208:3503] -[PFUbiquityTransactionLog loadComparisonMetadataWithError:](220): CoreData: Ubiquity:  Error encountered while trying to load the comparison metadata for transaction log: <PFUbiquityTransactionLog: 0x1a3d60>
transactionLogLocation: <PFUbiquityLocation: 0x1993c0>: /private/var/mobile/Library/Mobile Documents/ ...
transactionNumber: (null)
 
Error: Error Domain=NSCocoaErrorDomain Code=134302 "The operation couldn’t be completed. (Cocoa error 134302.)" UserInfo=0x1a50e0 {reason=Error during property list parsing during import or opening of log file at location: <PFUbiquityLocation: 0x1993c0>: /private/var/mobile/Library/Mobile Documents/ ... Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256 - The item failed to download.)"
....
2011-10-10 15:02:26.649 Recipes[2208:3503] -[_PFUbiquityStack shouldProcessTransactionLogAtLocation:error:](803): CoreData: Ubiquity:  Couldn't open transaction log at URL: <PFUbiquityLocation: 0x1993c0>: /private/var/mobile/Library/Mobile Documents/...." UserInfo=0x1a50e0 {reason=Error during property list parsing during import or opening of log file at location: <PFUbiquityLocation: 0x1993c0>: /private/var/mobile/Library/Mobile Documents/ ...

Regression:

Notes:

Comments

Same error in 5.1

is there a status update available?

Same errors

Setting the merge policy didn't quite do it for me... any fixes in the last month?

Possible fix?

Not 100% if this is fixing the problem. The huge exception text still gets pumped through but now the changes merge ok. In testing I've been updating separate attributes of the same entity instance on two iOS devices and now the changes merge in. If the same attribute is changed by the two devices , the last one wins. The fix was to set the merge policy when you create the managedObjectContext in the appdelegate or wherever you're creating it.

[__managedObjectContext setMergePolicy:NSMergeByPropertyStoreTrumpMergePolicy];

Add this just before returning the newly created __managedObjectContext.

By stevepearsonsage at Nov. 15, 2011, 10:05 p.m. (reply...)

Same problem.

I'm getting the exact same error message. Does anyone know of a way to get around this?

By briandoig1 at Nov. 15, 2011, 4:50 p.m. (reply...)

Seeing similar errors

I'm getting the same issue but I tracked it down to making changes to the same entity. I changed two separate attributes on the same entity and posted. The second update caused the exception to be thrown.

Have you got anywhere with this? There's not a great deal on the apple site about Core Data and conflict resolution.

Interestingly if you so the same in Address book, the last update appears to win and gets propagated to both devices.

By stevepearsonsage at Nov. 15, 2011, 8:26 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!