Fixes potentially incorrect bundle identifier when resigning AltStore with DEBUG build

This commit is contained in:
Riley Testut
2020-03-31 14:33:13 -07:00
parent 193ca28c98
commit 0f939700e2

View File

@@ -123,6 +123,10 @@ extension FetchProvisioningProfilesOperation
let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), app.bundleIdentifier)
if let installedApp = InstalledApp.first(satisfying: predicate, in: context)
{
// Teams match if installedApp.team has same identifier as team,
// or if installedApp.team is nil but resignedBundleIdentifier contains the team's identifier.
let teamsMatch = installedApp.team?.identifier == team.identifier || (installedApp.team == nil && installedApp.resignedBundleIdentifier.contains(team.identifier))
#if DEBUG
if app.bundleIdentifier == StoreApp.altstoreAppID || app.bundleIdentifier == StoreApp.alternativeAltStoreAppID
@@ -132,15 +136,11 @@ extension FetchProvisioningProfilesOperation
}
else
{
preferredBundleID = installedApp.resignedBundleIdentifier
preferredBundleID = teamsMatch ? installedApp.resignedBundleIdentifier : nil
}
#else
// Teams match if installedApp.team has same identifier as team,
// or if installedApp.team is nil but resignedBundleIdentifier contains the team's identifier.
let teamsMatch = installedApp.team?.identifier == team.identifier || (installedApp.team == nil && installedApp.resignedBundleIdentifier.contains(team.identifier))
if teamsMatch
{
// This app is already installed with the same team, so use the same resigned bundle identifier as before.