[AltBackup] Derives backup location from original bundle ID, not resigned one

Allows the backup to be used even if the app is later installed with a different developer team.
This commit is contained in:
Riley Testut
2020-05-15 14:44:29 -07:00
parent 8354794c24
commit 7cbe921020
2 changed files with 8 additions and 2 deletions

View File

@@ -89,7 +89,9 @@ class BackupController: NSObject
{
do
{
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to create backup directory.", comment: "")) }
guard let bundleIdentifier = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.altBundleID) as? String else {
throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to create backup directory.", comment: ""))
}
guard
let altstoreAppGroup = Bundle.main.altstoreAppGroup,
@@ -186,7 +188,9 @@ class BackupController: NSObject
{
do
{
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to access backup.", comment: "")) }
guard let bundleIdentifier = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.altBundleID) as? String else {
throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to access backup.", comment: ""))
}
guard
let altstoreAppGroup = Bundle.main.altstoreAppGroup,