AppMigrationKit
One-time cross-platform data transfer for app resources. Enables apps to
export data to or import data from another platform (for example, Android)
during device setup or onboarding. AppMigrationKit APIs are iOS 26.0+ /
iPadOS 26.0+; the data-container entitlement is iOS 26.1+ / iPadOS 26.1+ /
Mac Catalyst 26.1+. Swift 6.3.
Beta-sensitive. AppMigrationKit is new in iOS 26 and may change before GM.
Re-check current Apple documentation before relying on specific API details.
AppMigrationKit uses an app extension model. The system orchestrates the
transfer between devices. The app provides an extension conforming to export
and import protocols, and the system calls that extension at the appropriate
time. The app itself never manages the network connection between devices.
Contents
Workflow
- Confirm platform availability, migration entitlement, extension target, and shared-container layout.
- Inventory transportable resources, stable paths, size limits, versioning, and source-app identity.
- Export directly through
ResourcesArchiver with bounded gaps, progress, and cancellation propagation.
- Import transactionally, validate every resource, preserve recoverable evidence, and clean app-group state after success or failure.
- Verify with
AppMigrationTester, cancellation, partial archives, version skew, low storage, retry, and status clearing.
Route by Task
- Read core implementation details for architecture, entitlements, export/import, status, progress, testing, and error recovery.
- Read extended AppMigrationKit patterns for combined extensions, versioned migration, enumeration, and complex recovery flows.
Core Decisions
- Archive original resources directly instead of converting them during export.
- Propagate archiver cancellation and avoid long pauses between append operations.
- Validate imported paths and content before committing destination state.
- Clear migration/import status only after the app has durably handled the result.
Common Mistakes
DON'T: Catch cancellation errors from ResourcesArchiver
// WRONG -- system kills the extension if cancellation is swallowed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
do {
try await archiver.appendItem(at: fileURL)
} catch is CancellationError {
// Swallowing this causes termination
}
}
// CORRECT -- let cancellation propagate
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
try await archiver.appendItem(at: fileURL)
}
DON'T: Leave long gaps between archiver append calls
// WRONG -- system may assume the extension is hung and terminate it
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
let allFiles = gatherAllFiles() // Takes 30 seconds
for file in allFiles {
try await archiver.appendItem(at: file)
}
}
// CORRECT -- interleave file preparation with archiving
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
for file in knownFilePaths() {
try await archiver.appendItem(at: file)
}
}
DON'T: Convert files to intermediate format during export
// WRONG -- may exhaust disk space creating temporary copies
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
let converted = try convertToJSON(originalDatabase) // Doubles disk usage
try await archiver.appendItem(at: converted)
}
// CORRECT -- export files as-is, convert on import side if needed
func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {
try await archiver.appendItem(at: originalDatabase)
}
DON'T: Ignore app group containers during import error recovery
// WRONG -- system clears app container but not app groups on error
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
try writeToAppGroup(data)
try writeToAppContainer(data) // If this throws, app group has stale data
}
// CORRECT -- clear app group data before importing
func importResources(at url: URL, request: ResourcesImportRequest) async throws {
try clearAppGroupData()
try writeToAppGroup(data)
try writeToAppContainer(data)
}
DON'T: Forget to clear import status after handling it
// WRONG -- migration UI shows every launch
if let status = MigrationStatus.importStatus {
showMigrationResult(status)
// Missing clearImportStatus()
}
// CORRECT
if let status = MigrationStatus.importStatus {
showMigrationResult(status)
MigrationStatus.clearImportStatus()
}
Review Checklist
References
1---2name: appmigrationkit3description: Builds one-time cross-platform app-data transfers with AppMigrationKit. Use for AppMigrationExtension setup, ResourcesArchiver export/import, transportable resources, progress, cancellation, MigrationStatus, app-group cleanup, recovery, or AppMigrationTester verification.4---56# AppMigrationKit78One-time cross-platform data transfer for app resources. Enables apps to9export data to or import data from another platform (for example, Android)10during device setup or onboarding. AppMigrationKit APIs are iOS 26.0+ /11iPadOS 26.0+; the data-container entitlement is iOS 26.1+ / iPadOS 26.1+ /12Mac Catalyst 26.1+. Swift 6.3.1314> **Beta-sensitive.** AppMigrationKit is new in iOS 26 and may change before GM.15> Re-check current Apple documentation before relying on specific API details.1617AppMigrationKit uses an app extension model. The system orchestrates the18transfer between devices. The app provides an extension conforming to export19and import protocols, and the system calls that extension at the appropriate20time. The app itself never manages the network connection between devices.2122## Contents2324- [Workflow](#workflow)25- [Route by Task](#route-by-task)26- [Core Decisions](#core-decisions)27- [Common Mistakes](#common-mistakes)28- [Review Checklist](#review-checklist)29- [References](#references)3031## Workflow32331. Confirm platform availability, migration entitlement, extension target, and shared-container layout.342. Inventory transportable resources, stable paths, size limits, versioning, and source-app identity.353. Export directly through `ResourcesArchiver` with bounded gaps, progress, and cancellation propagation.364. Import transactionally, validate every resource, preserve recoverable evidence, and clean app-group state after success or failure.375. Verify with `AppMigrationTester`, cancellation, partial archives, version skew, low storage, retry, and status clearing.3839## Route by Task4041- Read [core implementation details](references/core-implementation.md) for architecture, entitlements, export/import, status, progress, testing, and error recovery.42- Read [extended AppMigrationKit patterns](references/appmigrationkit-patterns.md) for combined extensions, versioned migration, enumeration, and complex recovery flows.4344## Core Decisions4546- Archive original resources directly instead of converting them during export.47- Propagate archiver cancellation and avoid long pauses between append operations.48- Validate imported paths and content before committing destination state.49- Clear migration/import status only after the app has durably handled the result.5051## Common Mistakes5253### DON'T: Catch cancellation errors from ResourcesArchiver5455```swift56// WRONG -- system kills the extension if cancellation is swallowed57func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {58 do {59 try await archiver.appendItem(at: fileURL)60 } catch is CancellationError {61 // Swallowing this causes termination62 }63}6465// CORRECT -- let cancellation propagate66func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {67 try await archiver.appendItem(at: fileURL)68}69```7071### DON'T: Leave long gaps between archiver append calls7273```swift74// WRONG -- system may assume the extension is hung and terminate it75func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {76 let allFiles = gatherAllFiles() // Takes 30 seconds77 for file in allFiles {78 try await archiver.appendItem(at: file)79 }80}8182// CORRECT -- interleave file preparation with archiving83func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {84 for file in knownFilePaths() {85 try await archiver.appendItem(at: file)86 }87}88```8990### DON'T: Convert files to intermediate format during export9192```swift93// WRONG -- may exhaust disk space creating temporary copies94func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {95 let converted = try convertToJSON(originalDatabase) // Doubles disk usage96 try await archiver.appendItem(at: converted)97}9899// CORRECT -- export files as-is, convert on import side if needed100func exportResources(to archiver: sending ResourcesArchiver, request: ...) async throws {101 try await archiver.appendItem(at: originalDatabase)102}103```104105### DON'T: Ignore app group containers during import error recovery106107```swift108// WRONG -- system clears app container but not app groups on error109func importResources(at url: URL, request: ResourcesImportRequest) async throws {110 try writeToAppGroup(data)111 try writeToAppContainer(data) // If this throws, app group has stale data112}113114// CORRECT -- clear app group data before importing115func importResources(at url: URL, request: ResourcesImportRequest) async throws {116 try clearAppGroupData()117 try writeToAppGroup(data)118 try writeToAppContainer(data)119}120```121122### DON'T: Forget to clear import status after handling it123124```swift125// WRONG -- migration UI shows every launch126if let status = MigrationStatus.importStatus {127 showMigrationResult(status)128 // Missing clearImportStatus()129}130131// CORRECT132if let status = MigrationStatus.importStatus {133 showMigrationResult(status)134 MigrationStatus.clearImportStatus()135}136```137138## Review Checklist139140- [ ] Extension target added with `com.apple.developer.app-migration.data-container-access` entitlement141- [ ] Entitlement array contains exactly one string: the containing app's bundle identifier142- [ ] Extension conforms to `ResourcesExportingWithOptions` or `ResourcesExporting` for export143- [ ] Extension conforms to `ResourcesImporting` for import144- [ ] `resourcesSizeEstimate` returns a reasonable byte estimate145- [ ] `resourcesVersion` is set and will be checked on import for format compatibility146- [ ] Export calls `appendItem` incrementally without long pauses147- [ ] Cancellation errors from `ResourcesArchiver` are not caught148- [ ] Import clears app group containers before writing new data149- [ ] Containing app checks `MigrationStatus.importStatus` on first launch150- [ ] `clearImportStatus()` called after handling the migration result151- [ ] `AppMigrationTester` used in unit tests to validate export and import152- [ ] Files are exported as-is without intermediate format conversion on the export side153- [ ] `sourceVersion` from import request used to handle versioned data formats154155## References156157- Extended patterns (combined extension, versioned migration, file enumeration, error recovery): [references/appmigrationkit-patterns.md](references/appmigrationkit-patterns.md)158- [AppMigrationKit framework](https://sosumi.ai/documentation/appmigrationkit)159- [AppMigrationExtension](https://sosumi.ai/documentation/appmigrationkit/appmigrationextension)160- [ResourcesExportingWithOptions](https://sosumi.ai/documentation/appmigrationkit/resourcesexportingwithoptions)161- [ResourcesImporting](https://sosumi.ai/documentation/appmigrationkit/resourcesimporting)162- [ResourcesArchiver](https://sosumi.ai/documentation/appmigrationkit/resourcesarchiver)163- [MigrationStatus](https://sosumi.ai/documentation/appmigrationkit/migrationstatus)164- [MigrationDataContainer](https://sosumi.ai/documentation/appmigrationkit/migrationdatacontainer)165- [AppMigrationTester](https://sosumi.ai/documentation/appmigrationkit/appmigrationtester)166- [Data container entitlement](https://sosumi.ai/documentation/bundleresources/entitlements/com.apple.developer.app-migration.data-container-access)167- [Core implementation details](references/core-implementation.md) -- setup, API wiring, and focused implementation recipes moved out of the entrypoint.