0

Ensembles v2.5 をアプリに統合し、CloudKit ファイル システムを使用しています。Ensembles のドキュメントで説明されているように、マージはプッシュ通知を介して自動的にトリガーされます。

一般的に同期は機能しますが、私の問題は、変更が CloudKit を介して 2 番目のデバイスに同期された後、2 番目のデバイスが新しいトランザクション ログを CloudKit にアップロードし、1 番目のデバイスで (プッシュ通知を介して) 別のマージをトリガーするように見えることです。場合によっては、2 番目のデバイスで別のマージが行われ、2 つの不要なマージが発生することがあります。

実用的な例:
1) デバイス 1 (iPad) が変更を行う
2) 変更が CloudKit に伝達される
3) プッシュ通知がデバイス 2 (iPod Touch) でマージをトリガーする

iPad と iPod Touch は現在同じデータを持っているため、マージは行われませんが、次のようになります。

4) iPod Touch が新しいトランザクション ログを作成する
5) プッシュ通知が iPad でマージをトリガーする
6) iPad が新しいトランザクション ログを作成する
7) プッシュ通知が iPod Touch をマージする

デバイス 2 (iPod Touch) のアンサンブル トレースは次のとおりです。

18:16:28.202   Enqueuing merge                                               <<<  -[CDEPersistentStoreEnsemble mergeWithOptions:completion:]
18:16:28.215   Beginning merge                                               <<<  __47-[CDEPersistentStoreEnsemble newMergeSetupStep]_block_invoke
18:16:28.234   Priming CloudKit cache                                        <<<  -[CDECloudKitFileSystem primeForActivityWithCompletion:]
18:16:28.235   Beginning change processing for CloudKit.                     <<<  -[CDECloudKitFileSystem primeForActivityWithCompletion:]
18:16:28.872   Processed cloudkit change (insert/update): /DemoAppMainStore/events/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent  <<<  __56-[CDECloudKitFileSystem primeForActivityWithCompletion:]_block_invoke
18:16:28.876   Completing CloudKit fetch record changes                      <<<  __56-[CDECloudKitFileSystem primeForActivityWithCompletion:]_block_invoke.311
18:16:28.887   Checking identity in cloud system                             <<<  -[CDEPersistentStoreEnsemble checkCloudFileSystemIdentityWithCompletion:]
18:16:29.314   Passed identity check with identity: <CKRecordID: 0x1660a840; _7fd2f6a37e22282e02a1d8fb52ba2d8e:(_defaultZone:__defaultOwner__)>  <<<  __73-[CDEPersistentStoreEnsemble checkCloudFileSystemIdentityWithCompletion:]_block_invoke
18:16:29.324   Checking registration info                                    <<<  -[CDEPersistentStoreEnsemble checkStoreRegistrationInCloudWithCompletion:]
18:16:29.325   Checking existence of registration info                       <<<  -[CDECloudManager checkExistenceOfRegistrationInfoForStoreWithIdentifier:completion:]
18:16:29.326   Checking existence of file: /DemoAppMainStore/stores/0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA  <<<  -[CDECloudKitFileSystem fileExistsAtPath:completion:]
18:16:29.329   Retrieving records for paths: (
    "/DemoAppMainStore/stores/0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA"
)  <<<  -[CDECloudKitFileSystem fetchRecordsAtPaths:completion:]
18:16:29.330   File exists. Is dir? 0                                        <<<  __53-[CDECloudKitFileSystem fileExistsAtPath:completion:]_block_invoke
18:16:29.343 Localizable string "(A Document Being Saved By %@)" not found in strings table "Document" of bundle CFBundle 0x166429d0 </System/Library/Frameworks/Foundation.framework> (not loaded).
18:16:29.380   Getting contents of directory at path: /DemoAppMainStore/baselines  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:29.383   Getting contents of directory at path: /DemoAppMainStore/events  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:29.386   Getting contents of directory at path: /DemoAppMainStore/data  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:29.394   Removing incomplete remote file sets                          <<<  -[CDECloudManager removeLocallyProducedIncompleteRemoteFileSets:]
18:16:29.447   Transferring new data files from cloud to event store         <<<  -[CDECloudManager importNewDataFilesWithProgress:]
18:16:29.459   Transferring new baselines from cloud to event store          <<<  -[CDECloudManager importNewBaselineEventsWithProgress:]
18:16:29.486   Consolidating baselines                                       <<<  -[CDEBaselineConsolidator consolidateBaselineWithCompletion:]
18:16:29.498   Found baselines with unique ids: (
    "848B3010-D3D0-4928-BFA9-249D2CE617A0-777-000002E2704C7408"
)  <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke
18:16:29.499   Baselines remaining that need merging: 1                      <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke
18:16:29.501   Finishing baseline consolidation                              <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke_2
18:16:29.506   Transferring new events from cloud to event store             <<<  -[CDECloudManager importNewRemoteNonBaselineEventsWithProgress:]
18:16:29.588   Downloading files to transit cache: (
    "/DemoAppMainStore/events/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent"
)  <<<  __83-[CDECloudManager downloadFiles:fromRemoteDirectory:batchCompletionBlock:progress:]_block_invoke_2
18:16:29.591   Downloading from paths (
    "/DemoAppMainStore/events/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent"
) to path (
    "/var/mobile/Containers/Data/Application/3EA6BB44-7135-4C5D-91D3-D36878005B1C/Library/Application Support/ch.appzoo.DemoApp/com.mentalfaculty.ensembles.eventdata/transitcache/DemoAppMainStore/download/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent"
)  <<<  -[CDECloudKitFileSystem downloadFromPaths:toLocalFiles:completion:]
18:16:32.120   Migrating event in to event store from files: (
    "33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent"
)  <<<  __84-[CDECloudManager migrateNewEventsWhichAreBaselines:fromTransitCacheWithCompletion:]_block_invoke.292
18:16:32.121   Migrating events in from files                                <<<  -[CDEEventMigrator migrateEventInFromFileURLs:completion:]
18:16:32.124   Migrating file events to event store                          <<<  -[CDEEventImport main]
18:16:32.125   Importing file at URL: file:///var/mobile/Containers/Data/Application/3EA6BB44-7135-4C5D-91D3-D36878005B1C/Library/Application%20Support/ch.appzoo.DemoApp/com.mentalfaculty.ensembles.eventdata/transitcache/DemoAppMainStore/download/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent  <<<  __22-[CDEEventImport main]_block_invoke.22
18:16:32.382   Determining events to include in integration                  <<<  -[CDEEventIntegrator storeModificationEventIDsForIntegration:]
18:16:32.546   Including these events in the integration: (
    "<CDEStoreModificationEvent: 0x167b3590> (entity: CDEStoreModificationEvent; id: 0x167d6720 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEStoreModificationEvent/p37> ; data: {\n    eventRevision = \"0x167a7280 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p72>\";\n    eventRevisionsOfOtherStores =     (\n        \"0x167ddf40 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p71>\"\n    );\n    globalCount = 32;\n    modelVersion = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\\n<plist version=\\\"1.0\\\">\\n<dict>\\n\\t<key>DMBuddy</key>\\n\\t<data>\\n\\t\";\n    objectChanges = \"<relationship fault: 0x17878a60 'objectChanges'>\";\n    timestamp = \"16:49:55 +0000\";\n    type = 300;\n    uniqueIdentifier = \"E432A13E-3825-4833-A306-F84044492252-498-0000010ED9BE7E88\";\n})",
    "<CDEStoreModificationEvent: 0x167b3620> (entity: CDEStoreModificationEvent; id: 0x16730ac0 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEStoreModificationEvent/p38> ; data: {\n    eventRevision = \"0x166b4420 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p73>\";\n    eventRevisionsOfOtherStores =     (\n        \"0x167ecb10 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p74>\"\n    );\n    globalCount = 33;\n    modelVersion = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\\n<plist version=\\\"1.0\\\">\\n<dict>\\n\\t<key>DMBuddy</key>\\n\\t<data>\\n\\t\";\n    objectChanges = \"<relationship fault: 0x1651f9a0 'objectChanges'>\";\n    timestamp = \"17:16:23 +0000\";\n    type = 200;\n    uniqueIdentifier = \"83664AB6-F3FE-4454-B794-12858EB3215C-501-00000110A14995E1\";\n})"
)  <<<  __62-[CDEEventIntegrator storeModificationEventIDsForIntegration:]_block_invoke
18:16:32.550   Checking which events can be integrated                       <<<  -[CDEEventIntegrator integrableEventIDsFromEventIDs:informativeErrorCodes:]
18:16:32.554   Determining integrable events                                 <<<  -[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]
18:16:39.046   Checking store: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:39.047   Revision range: store id: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3
revision: 20
global count: 32 store id: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3
revision: 21
global count: 33  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:39.098   Checking store: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:39.099   Revision range: store id: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA
revision: 15
global count: 32 store id: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA
revision: 15
global count: 33  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:39.131   Checking if ready for integration                             <<<  -[CDEEventIntegrator integrationIsNeededForEventIDs:]
18:16:39.254   Beginning integration                                         <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.256   Integrating entity: DMBuddy                                   <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.267   Integrating entity: DMCertificate                             <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.287   Integrating entity: DMDiveLogEntry                            <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.309   Number of objects remaining to integrate for this entity: 0   <<<  __46-[CDEEventIntegrator integrateEventIDs:error:]_block_invoke
18:16:39.431   Integrating entity: DMDiver                                   <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.555   Integrating entity: DMEquipment                               <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.603   Integrating entity: DMPhoto                                   <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.672   Integrating entity: DMPlace                                   <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.765   Integrating entity: DMTagValue                                <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.784   Integrating entity: DMTankData                                <<<  -[CDEEventIntegrator integrateEventIDs:error:]
18:16:39.851   Repairing context after integrating changes                   <<<  -[CDEEventIntegrator repair:]
18:16:39.856   Committing merge changes to store                             <<<  -[CDEEventIntegrator commit:]
18:16:39.863   Storing pre-save changes from updated objects                 <<<  -[CDESaveMonitor storePreSaveChangesFromUpdatedObjects:]
18:16:40.045   Transferring data files from event store to cloud             <<<  -[CDECloudManager exportDataFilesWithProgress:]
18:16:40.094   Transferring baseline from event store to cloud               <<<  -[CDECloudManager exportNewLocalBaselineWithProgress:]
18:16:40.176   Transferring events from event store to cloud                 <<<  -[CDECloudManager exportNewLocalNonBaselineEventsWithProgress:]
18:16:40.322   Migrating events out to files                                 <<<  -[CDEEventMigrator migrateStoreModificationEventWithObjectID:toTemporaryFilesWithCompletion:]
18:16:40.369   Exporting files for entity: DMBuddy                           <<<  -[CDEEventExport main]
18:16:40.382   Exporting files for entity: DMCertificate                     <<<  -[CDEEventExport main]
18:16:40.394   Exporting files for entity: DMDiveLogEntry                    <<<  -[CDEEventExport main]
18:16:40.406   Exporting files for entity: DMDiver                           <<<  -[CDEEventExport main]
18:16:40.414   Exporting files for entity: DMEquipment                       <<<  -[CDEEventExport main]
18:16:40.423   Exporting files for entity: DMPhoto                           <<<  -[CDEEventExport main]
18:16:40.431   Exporting files for entity: DMPlace                           <<<  -[CDEEventExport main]
18:16:40.441   Exporting files for entity: DMTagValue                        <<<  -[CDEEventExport main]
18:16:40.451   Exporting files for entity: DMTankData                        <<<  -[CDEEventExport main]
18:16:40.485   Uploading files to remote path: (
    "/DemoAppMainStore/events/34_0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA_16.cdeevent"
)  <<<  __73-[CDECloudManager transferFilesInTransitCacheToRemoteDirectory:progress:]_block_invoke_3
18:16:40.487   Uploading from paths (
    "/var/mobile/Containers/Data/Application/3EA6BB44-7135-4C5D-91D3-D36878005B1C/Library/Application Support/ch.appzoo.DemoApp/com.mentalfaculty.ensembles.eventdata/transitcache/DemoAppMainStore/upload/34_0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA_16.cdeevent"
) to paths (
    "/DemoAppMainStore/events/34_0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA_16.cdeevent"
)  <<<  -[CDECloudKitFileSystem uploadLocalFiles:toPaths:completion:]
18:16:42.525   Removing outdated files                                       <<<  -[CDECloudManager removeOutdatedRemoteFilesWithCompletion:]
18:16:42.607   Removing cloud files:                                         <<<  -[CDECloudManager removeOutdatedRemoteFilesWithCompletion:]
18:16:42.625   Removing items at paths: (
)                                  <<<  -[CDECloudKitFileSystem removeItemsAtPaths:completion:]
18:16:42.626   Retrieving records for paths: (
)                             <<<  -[CDECloudKitFileSystem fetchRecordsAtPaths:completion:]
18:16:42.628   Fetched records for removal: (
)                              <<<  __55-[CDECloudKitFileSystem removeItemsAtPaths:completion:]_block_invoke
18:16:42.630   Removing items with recordIDs: (
)                            <<<  -[CDECloudKitFileSystem removeItemsWithRecordIDs:completion:]
18:16:42.651   Completing Merge                                              <<<  __58-[CDEPersistentStoreEnsemble mergeWithOptions:completion:]_block_invoke.694



18:16:48.068   Enqueuing merge                                               <<<  -[CDEPersistentStoreEnsemble mergeWithOptions:completion:]
18:16:48.082   Beginning merge                                               <<<  __47-[CDEPersistentStoreEnsemble newMergeSetupStep]_block_invoke
18:16:48.096   Priming CloudKit cache                                        <<<  -[CDECloudKitFileSystem primeForActivityWithCompletion:]
18:16:48.097   Beginning change processing for CloudKit.                     <<<  -[CDECloudKitFileSystem primeForActivityWithCompletion:]

18:16:48.464   Processed cloudkit change (insert/update): /DemoAppMainStore/events/34_0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA_16.cdeevent  <<<  __56-[CDECloudKitFileSystem primeForActivityWithCompletion:]_block_invoke
18:16:48.474   Processed cloudkit change (insert/update): /DemoAppMainStore/events/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent  <<<  __56-[CDECloudKitFileSystem primeForActivityWithCompletion:]_block_invoke
18:16:48.477   Completing CloudKit fetch record changes                      <<<  __56-[CDECloudKitFileSystem primeForActivityWithCompletion:]_block_invoke.311
18:16:48.489   Checking identity in cloud system                             <<<  -[CDEPersistentStoreEnsemble checkCloudFileSystemIdentityWithCompletion:]
18:16:48.884   Passed identity check with identity: <CKRecordID: 0x1660a840; _7fd2f6a37e22282e02a1d8fb52ba2d8e:(_defaultZone:__defaultOwner__)>  <<<  __73-[CDEPersistentStoreEnsemble checkCloudFileSystemIdentityWithCompletion:]_block_invoke
18:16:48.889   Checking registration info                                    <<<  -[CDEPersistentStoreEnsemble checkStoreRegistrationInCloudWithCompletion:]
18:16:48.890   Checking existence of registration info                       <<<  -[CDECloudManager checkExistenceOfRegistrationInfoForStoreWithIdentifier:completion:]
18:16:48.891   Checking existence of file: /DemoAppMainStore/stores/0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA  <<<  -[CDECloudKitFileSystem fileExistsAtPath:completion:]
18:16:48.892   Retrieving records for paths: (
    "/DemoAppMainStore/stores/0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA"
)  <<<  -[CDECloudKitFileSystem fetchRecordsAtPaths:completion:]
18:16:48.893   File exists. Is dir? 0                                        <<<  __53-[CDECloudKitFileSystem fileExistsAtPath:completion:]_block_invoke
18:16:48.907 Localizable string "(A Document Being Saved By %@)" not found in strings table "Document" of bundle CFBundle 0x166429d0 </System/Library/Frameworks/Foundation.framework> (not loaded).
18:16:48.942   Getting contents of directory at path: /DemoAppMainStore/baselines  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:48.944   Getting contents of directory at path: /DemoAppMainStore/events  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:48.947   Getting contents of directory at path: /DemoAppMainStore/data  <<<  -[CDECloudKitFileSystem contentsOfDirectoryAtPath:completion:]
18:16:48.954   Removing incomplete remote file sets                          <<<  -[CDECloudManager removeLocallyProducedIncompleteRemoteFileSets:]
18:16:49.016   Transferring new data files from cloud to event store         <<<  -[CDECloudManager importNewDataFilesWithProgress:]
18:16:49.028   Transferring new baselines from cloud to event store          <<<  -[CDECloudManager importNewBaselineEventsWithProgress:]
18:16:49.057   Consolidating baselines                                       <<<  -[CDEBaselineConsolidator consolidateBaselineWithCompletion:]
18:16:49.068   Found baselines with unique ids: (
    "848B3010-D3D0-4928-BFA9-249D2CE617A0-777-000002E2704C7408"
)  <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke
18:16:49.069   Baselines remaining that need merging: 1                      <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke
18:16:49.071   Finishing baseline consolidation                              <<<  __61-[CDEBaselineConsolidator consolidateBaselineWithCompletion:]_block_invoke_2
18:16:49.075   Transferring new events from cloud to event store             <<<  -[CDECloudManager importNewRemoteNonBaselineEventsWithProgress:]
18:16:49.150   Downloading files to transit cache: (
    "/DemoAppMainStore/events/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent"
)  <<<  __83-[CDECloudManager downloadFiles:fromRemoteDirectory:batchCompletionBlock:progress:]_block_invoke_2
18:16:49.153   Downloading from paths (
    "/DemoAppMainStore/events/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent"
) to path (
    "/var/mobile/Containers/Data/Application/3EA6BB44-7135-4C5D-91D3-D36878005B1C/Library/Application Support/ch.appzoo.DemoApp/com.mentalfaculty.ensembles.eventdata/transitcache/DemoAppMainStore/download/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent"
)  <<<  -[CDECloudKitFileSystem downloadFromPaths:toLocalFiles:completion:]
18:16:50.214   Migrating event in to event store from files: (
    "35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent"
)  <<<  __84-[CDECloudManager migrateNewEventsWhichAreBaselines:fromTransitCacheWithCompletion:]_block_invoke.292
18:16:50.215   Migrating events in from files                                <<<  -[CDEEventMigrator migrateEventInFromFileURLs:completion:]
18:16:50.218   Migrating file events to event store                          <<<  -[CDEEventImport main]
18:16:50.219   Importing file at URL: file:///var/mobile/Containers/Data/Application/3EA6BB44-7135-4C5D-91D3-D36878005B1C/Library/Application%20Support/ch.appzoo.DemoApp/com.mentalfaculty.ensembles.eventdata/transitcache/DemoAppMainStore/download/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent  <<<  __22-[CDEEventImport main]_block_invoke.22
18:16:50.456   Determining events to include in integration                  <<<  -[CDEEventIntegrator storeModificationEventIDsForIntegration:]
18:16:50.600   Including these events in the integration: (
    "<CDEStoreModificationEvent: 0x178b45e0> (entity: CDEStoreModificationEvent; id: 0x165342e0 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEStoreModificationEvent/p40> ; data: {\n    eventRevision = \"0x178a4cc0 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p77>\";\n    eventRevisionsOfOtherStores =     (\n        \"0x178a4cd0 <x-coredata://7EC8021F-B83B-4A27-B9B9-D1645A533448/CDEEventRevision/p78>\"\n    );\n    globalCount = 35;\n    modelVersion = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\\n<plist version=\\\"1.0\\\">\\n<dict>\\n\\t<key>DMBuddy</key>\\n\\t<data>\\n\\t\";\n    objectChanges = \"<relationship fault: 0x1651e8d0 'objectChanges'>\";\n    timestamp = \"17:16:45 +0000\";\n    type = 300;\n    uniqueIdentifier = \"3F19C4EE-816D-425F-99BC-BE991EEE1476-501-00000110C03D4133\";\n})"
)  <<<  __62-[CDEEventIntegrator storeModificationEventIDsForIntegration:]_block_invoke
18:16:50.601   Checking which events can be integrated                       <<<  -[CDEEventIntegrator integrableEventIDsFromEventIDs:informativeErrorCodes:]
18:16:50.603   Determining integrable events                                 <<<  -[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]
18:16:54.843   Checking store: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:54.845   Revision range: store id: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3
revision: 22
global count: 35 store id: 826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3
revision: 22
global count: 35  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:54.872   Checking store: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:54.874   Revision range: store id: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA
revision: 16
global count: 35 store id: 0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA
revision: 16
global count: 35  <<<  __71-[CDERevisionManager integrableEventsFromEvents:informativeErrorCodes:]_block_invoke
18:16:54.903   Checking if ready for integration                             <<<  -[CDEEventIntegrator integrationIsNeededForEventIDs:]
18:16:54.975   Transferring data files from event store to cloud             <<<  -[CDECloudManager exportDataFilesWithProgress:]
18:16:54.996   Transferring baseline from event store to cloud               <<<  -[CDECloudManager exportNewLocalBaselineWithProgress:]
18:16:55.058   Transferring events from event store to cloud                 <<<  -[CDECloudManager exportNewLocalNonBaselineEventsWithProgress:]
18:16:55.163   Removing outdated files                                       <<<  -[CDECloudManager removeOutdatedRemoteFilesWithCompletion:]
18:16:55.249   Removing cloud files:                                         <<<  -[CDECloudManager removeOutdatedRemoteFilesWithCompletion:]
18:16:55.269   Removing items at paths: (
)                                  <<<  -[CDECloudKitFileSystem removeItemsAtPaths:completion:]
18:16:55.270   Retrieving records for paths: (
)                             <<<  -[CDECloudKitFileSystem fetchRecordsAtPaths:completion:]
18:16:55.273   Fetched records for removal: (
)                              <<<  __55-[CDECloudKitFileSystem removeItemsAtPaths:completion:]_block_invoke
18:16:55.274   Removing items with recordIDs: (
)                            <<<  -[CDECloudKitFileSystem removeItemsWithRecordIDs:completion:]
18:16:55.298   Completing Merge                                              <<<  __58-[CDEPersistentStoreEnsemble mergeWithOptions:completion:]_block_invoke.694

...そしてここにプッシュ通知があります:

IPOD TOUCH
18:16:28.199 | iCloudSyncActivity | Thread 16 | did receive remote notification, userInfo = '{
    aps =     {
        "content-available" = 1;
        sound = "";
    };
    ck =     {
        ce = 2;
        cid = "iCloud.com.example.app";
        nid = "cc0f33fc-0488-4abb-b9aa-2bfd7c8db88b";
        qry =         {
            dbs = 1;
            fo = 1;
            rid = "CDEFileSystemNode_/DiveMateMainStore/events/33_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_21.cdeevent";
            sid = CDEFileAddedSubscription;
            zid = "com.mentalfaculty.ensembles.zone.schema2";
            zoid = "_7fd2f6a37e22282e02a1d8fb52ba2d8e";
        };
    };
}'

IPAD:
18:16:42.258 | iCloudSyncActivity | Thread 15 | did receive remote notification, userInfo = '{
    aps =     {
        "content-available" = 1;
        sound = "";
    };
    ck =     {
        ce = 2;
        cid = "iCloud.com.example.app";
        nid = "2bb1a2f0-5dbb-47b7-b6e1-1e6de9afdac9";
        qry =         {
            dbs = 1;
            fo = 1;
            rid = "CDEFileSystemNode_/DiveMateMainStore/events/34_0B96EB62-03B1-414F-BBA5-3FCBDD2E9CD4-777-000002E26205C2DA_16.cdeevent";
            sid = CDEFileAddedSubscription;
            zid = "com.mentalfaculty.ensembles.zone.schema2";
            zoid = "_7fd2f6a37e22282e02a1d8fb52ba2d8e";
        };
    };
}'

IPOD TOUCH
[260     ] 18:16:48.064 | iCloudSyncActivity | Thread 16 | did receive remote notification, userInfo = '{
    aps =     {
        "content-available" = 1;
        sound = "";
    };
    ck =     {
        ce = 2;
        cid = "iCloud.com.example.app";
        nid = "4ee5383d-9a94-4596-99f2-18ae7da6e0ca";
        qry =         {
            dbs = 1;
            fo = 1;
            rid = "CDEFileSystemNode_/DiveMateMainStore/events/35_826D4BD2-2ED2-4C3B-9A89-22E3D910EC55-476-000000FAF9F774C3_22.cdeevent";
            sid = CDEFileAddedSubscription;
            zid = "com.mentalfaculty.ensembles.zone.schema2";
            zoid = "_7fd2f6a37e22282e02a1d8fb52ba2d8e";
        };
    };
}'


私にとって奇妙に思えるのは、アンサンブル トレースが 2 つのストアを参照していることです

参考までに、これがアンサンブルのセットアップ方法です。

_ensemble = [[CDEPersistentStoreEnsemble alloc] initWithEnsembleIdentifier:DM_ENSEMBLE_IDENTIFIER
                                                        persistentStoreURL:storeURL
                                                     managedObjectModelURL:[self _getManagedObjectModelURL]
                                                           cloudFileSystem:_iCloudFileSystem];

正しい方向へのヘルプ/ポインタは大歓迎です。

4

1 に答える 1

3

これは予期された動作であり、最後のマージは非常に高速になるはずです。多すぎると感じた場合は、プッシュ通知によってトリガーされるマージを簡単に抑制できます。例えば。マージを実行してから 1 分以内にプッシュが受信された場合は、それを無視することを選択できます。

変更ごとに 3 回のマージはノ​​ーオペレーションではありません。彼らは、すべてのデバイスが最終的に同じデータになるようにするために、重要な会計処理を行っています。

Git のようなアンサンブルを考えてみてください。内部的には、それは基本的にそれが何であるかです。ここで、1 つのデバイスで変更を行うと、そのデバイスで新しいコミット ( S1_D1) がトリガーされます。次に、マージを実行してデータをクラウドにプッシュします。

2 番目のデバイスは、プッシュ通知によりそのデータを取得するためにマージし、そのコミットを作成します ( M1_D2)。これには競合の解決が含まれる場合と含まれない場合がありますが、同時実行システムにとって重要です。これは、Git で 2 つのブランチをマージすることと同等であり、履歴でそれを表すには新しいコミットが必要です。

マージ ( M1_D2) がクラウドにプッシュされ、元のデバイスが新しいコミットを認識し、それをインポートするためにマージ操作を実行する必要がありますが、それ自体は新しいコミットを生成しません。

したがって、完全に完了するには、1 回の保存を元のデバイスでマージし、別のデバイスでマージし、元のデバイスでもう一度マージする必要があります。それが Git のようなシステムや Ensembles での動作です。

3 つのマージ操作が必要ですが、それらが発生するタイミングを完全に制御できることに注意してください。好きなだけ遅らせることも、前述のように特定のプッシュを無視することもできます。システムは、最終的にマージするときにすべてを把握するのに十分なほどスマートです (Git ができるように)。

于 2016-11-03T09:41:41.157 に答える