[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 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 guard
let altstoreAppGroup = Bundle.main.altstoreAppGroup, let altstoreAppGroup = Bundle.main.altstoreAppGroup,
@@ -186,7 +188,9 @@ class BackupController: NSObject
{ {
do 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 guard
let altstoreAppGroup = Bundle.main.altstoreAppGroup, let altstoreAppGroup = Bundle.main.altstoreAppGroup,

View File

@@ -6,6 +6,8 @@
<array> <array>
<string>group.com.rileytestut.AltStore</string> <string>group.com.rileytestut.AltStore</string>
</array> </array>
<key>ALTBundleIdentifier</key>
<string>com.rileytestut.AltBackup</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>