Errors while trying to use Core Data with iCloud and two persistent stores

Originator:fernandodeperto
Number:rdar://10380016 Date Originated:1/11/2011
Status:Open Resolved:
Product:iCloud Product Version:5.0 (9A334)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary: As suggested, I tried to implement a simple example of an app that uses two persistent stores do separate the data between local and cloud. The first thing that I did is implement the example with one persistent store using the iCloud options dictionary. That worked fine. 

After that I changed the code to first insert a local (with no options dictionary) persistent store and then used the same code used before to try (depending on the value of the cloudURL object) to insert the cloud persistent store. The persistent store is added successfully. 

When I'm creating a new managed object, I check if the persistent store coordinator has two persistent stores. If it has, I'm using the method assignObject:toPersistentStore: to assign this new object to the cloud persistent store. Based on the ~/Library/Mobile Documents folder on my Mac, that is working. 

The problem comes on the other device. It should receive the NSPersistentStoreDidImportUbiquitousContentChangesNotification, but instead the same two error always appear on the console. And they reappear repeatedly  after a few seconds:

2011-11-01 20:34:54.023 iCloudTest2[975:2403] CoreData: Ubiquity: Error importing transaction log: <PFUbiquityTransactionLog: 0x1f3d60>
	transactionLogLocation: <PFUbiquityLocation: 0x1f0ab0>: /private/var/mobile/Library/Mobile Documents/9GW85QW7HW~br~com~fernandodeperto~iCloudTest2/test_6/mobile.1FBC53AA-0881-5362-8C0D-32DC21BC92B5/br.com.fernandodeperto.iCloudTest2.6/shjumhMHJj17_m8uQXaO6Cr~lALxJF8ETR7T5q56_MY=/796CDC9D-0064-46E9-BEF8-377873C4CE7E.1.cdt
	transactionNumber: 1
, exception: -[__NSCFDictionary setObject:forKey:]: attempt to insert nil key

2011-11-01 20:34:54.032 iCloudTest2[975:2403] -[_PFUbiquityRecordsImporter operation:failedWithError:](839): CoreData: Ubiquity:  Import operation ecountered an error: Error Domain=NSCocoaErrorDomain Code=134060 "The operation couldn’t be completed. (Cocoa error 134060.)" UserInfo=0x15d630 {exception=-[__NSCFDictionary setObject:forKey:]: attempt to insert nil key} while trying to import the log file at the URL: <PFUbiquityTransactionLog: 0x1f3d60>
	transactionLogLocation: <PFUbiquityLocation: 0x1f0ab0>: /private/var/mobile/Library/Mobile Documents/9GW85QW7HW~br~com~fernandodeperto~iCloudTest2/test_6/mobile.1FBC53AA-0881-5362-8C0D-32DC21BC92B5/br.com.fernandodeperto.iCloudTest2.6/shjumhMHJj17_m8uQXaO6Cr~lALxJF8ETR7T5q56_MY=/796CDC9D-0064-46E9-BEF8-377873C4CE7E.1.cdt
	transactionNumber: 1

Steps to Reproduce: During the persistent store coordinator setup: insert a local persistent store; insert a cloud persistent store. On the MasterViewController, while adding a new managed object: check if the persistent store coordinator has two persistent stores; if it has, use the assignObject:toPersistentStore: method to assign it to the cloud persistent store; save the context.

Expected Results: The second device should receive the NSPersistentStoreDidImportUbiquitousContentChangesNotification and then the managed object should appear on the MasterViewController's table view.

Actual Results: The second device generates the same two errors repeatedly (check above).

Regression:

Notes: The local and cloud persistent stores are both being saved on the application's document directory but with different file names

Comments

Ditto

Running into same issue in 5.1 as well.

same issue

any response on this issue? I have it in 5.1


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!