Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Data with iCloud. Synchronisation problems. (MacOS vs iOS - conflicts)

I have some problems during the work with CoreData and iCloud. I have used example from apple developer forum (iCloud) - IPhoneCoreDataRecipes project that represents the work with CoreData through the iCloud. It works fine but there appear some conflicts and not all entities are synchronising.

I can see the following warnings in the log:

Warning>: +[PFUbiquityRecordImportConflict createTransactionLogForTransactionEntry:withError:](607): CoreData: Ubiquity:  Unable to find transaction log for entry: <PFUbiquityTransactionEntry: 0x68b9a60> (entity: PFUbiquityTransactionEntry; id: 0x68c5d50 <x-coredata://697F667C-7541-43E7-B21B-5362D165537B/PFUbiquityTransactionEntry/p2> ; data: {
    actingPeer = "0x1526e0 <x-coredata://697F667C-7541-43E7-B21B-5362D165537B/PFUbiquityPeer/p1>";
    globalIDStr = "com.appmania.dreambookdata.coredata:DreamHistory:p1:mobile.99829CE6-D497-590F-B2F8-795CFFC84CCB";
    knowledgeVectorString = "mobile.99829CE6-D497-590F-B2F8-795CFFC84CCB:1";
    localIDStr = "x-coredata://D45E85ED-A2B7-48AC-96BF-6B2C64812656/DreamHistory/p1";
    storeMetadata = "0x12d4a0 <x-coredata://697F667C-7541-43E7-B21B-5362D165537B/PFUbiquityStoreMetadata/p1>";
    transactionDate = "2011-12-01 08:00:13 +0000";
    transactionLogFilename = "7C9AD5E3-457E-4E2B-8F1C-A7D8878E5BDB.1.cdt";
    transactionNumber = 1;
    transactionTypeNum = 0;
})

Does someone know how such conflicts can be resolved? Thank you.

like image 357
user1116225 Avatar asked Nov 05 '22 08:11

user1116225


1 Answers

It is recommended that you specify a merge policy on your managed object context:

moc.mergePolicy = [[NSMergePolicy alloc] 
  initWithMergeType:NSMergeByPropertyObjectTrumpMergePolicyType];

There are also other merge policies, choose the one which fits your application.

like image 135
Rafael Bugajewski Avatar answered Nov 15 '22 05:11

Rafael Bugajewski