Hi,
Following the advice I received here, I switched to using NSStagedMigrationManager instead of trying to drive a custom NSMappingModel entirely in code.
I now have a staged migration pipeline with two stages:
• Stage 1 (V1 → V2): a lightweight migration.
• Stage 2 (V2 → V3): a custom migration where I re-archive a Transformable attribute (object) from a legacy ValueTransformer to a safe binary format (GraphArchiver).
Both models are built entirely at runtime (no .xcdatamodeld files).
Each model has a unique versionChecksum string (hardcoded identifiers: "GraphCK_MigrationV1", "GraphCK_MigrationV2", "GraphCK_MigrationV3").
When I run the staged migration manager with these two stages, I consistently hit this exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Duplicate version checksums across stages detected.'
Debug logging shows:
Stage1 checksums: ["GraphCK_MigrationV1", "GraphCK_MigrationV2"]
Stage2 checksums: ["GraphCK_MigrationV2", "GraphCK_MigrationV3"]
So the identifiers look correct and distinct, but the framework still complains about “duplicate checksums across stages”.
Question:
Is this error expected when building models entirely at runtime?
Do we need to persist .mom files or .xcmappingmodel files so the checksums are stable?
Or is there a supported way to run a staged migration pipeline from runtime-constructed models only?
Any insight on how to avoid the “duplicate version checksums” error when using NSStagedMigrationManager with runtime models would be greatly appreciated.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: