diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index a7bdb49d..9a3c0eab 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -362,7 +362,7 @@ extension FetchProvisioningProfilesOperation entitlements[key] = value } - let applicationGroups = entitlements[.appGroups] as? [String] ?? [] + var applicationGroups = entitlements[.appGroups] as? [String] ?? [] if applicationGroups.isEmpty { guard let isAppGroupsEnabled = appID.features[.appGroups] as? Bool, isAppGroupsEnabled else { @@ -374,6 +374,22 @@ extension FetchProvisioningProfilesOperation } } + if app.bundleIdentifier == StoreApp.altstoreAppID + { + // Updating app groups for this specific AltStore. + // Find the (unique) AltStore app group, then replace it + // with the correct "base" app group ID. + // Otherwise, we may append a duplicate team identifier to the end. + if let index = applicationGroups.firstIndex(where: { $0.contains(Bundle.baseAltStoreAppGroupID) }) + { + applicationGroups[index] = Bundle.baseAltStoreAppGroupID + } + else + { + applicationGroups.append(Bundle.baseAltStoreAppGroupID) + } + } + // Dispatch onto global queue to prevent appGroupsLock deadlock. DispatchQueue.global().async {