From e553efbad5223b01e84fecb82762a67acaa80536 Mon Sep 17 00:00:00 2001 From: mahee96 <47920326+mahee96@users.noreply.github.com> Date: Mon, 24 Mar 2025 01:32:01 -0700 Subject: [PATCH] - migration-fix: more reinforcements for 0.6.0 to 0.6.1 --- .../ReleaseTrack17To17_1MigrationPolicy.swift | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/AltStoreCore/Model/Migrations/Policies/v17-to-v17_1/ReleaseTrack17To17_1MigrationPolicy.swift b/AltStoreCore/Model/Migrations/Policies/v17-to-v17_1/ReleaseTrack17To17_1MigrationPolicy.swift index a4b19089..f9c58ec5 100644 --- a/AltStoreCore/Model/Migrations/Policies/v17-to-v17_1/ReleaseTrack17To17_1MigrationPolicy.swift +++ b/AltStoreCore/Model/Migrations/Policies/v17-to-v17_1/ReleaseTrack17To17_1MigrationPolicy.swift @@ -32,12 +32,26 @@ class ReleaseTrack17To17_1MigrationPolicy: NSEntityMigrationPolicy { // set initial values copied from source as-is to satisfy unique constraints // (will be updated by StoreApp and Source migration policy in its createRelationship() method) - if let appBundle = storeApp.value(forKey: #keyPath(StoreApp.bundleIdentifier)) as? String{ + let appBundle = storeApp.value(forKey: #keyPath(StoreApp.bundleIdentifier)) as? String + let sourceID = storeApp.value(forKey: #keyPath(StoreApp.sourceIdentifier)) as? String + + if let appBundle { dInstance.setValue(appBundle, forKey: #keyPath(ReleaseTrack._appBundleID)) } - if let sourceID = storeApp.value(forKey: #keyPath(StoreApp.sourceIdentifier)) as? String { + if let sourceID { dInstance.setValue(sourceID, forKey: #keyPath(ReleaseTrack._sourceID)) } + + if let releases = dInstance.value(forKey: #keyPath(ReleaseTrack._releases)) as? NSOrderedSet { + for case let version as NSManagedObject in releases { + if let appBundle { + version.setValue(appBundle, forKey: #keyPath(AppVersion.appBundleID)) + } + if let sourceID { + version.setValue(sourceID, forKey: #keyPath(AppVersion.sourceID)) + } + } + } } }