Preserve device specific keys in Info.plist

Apple's Info.plist support platform and device specific keys to augment existing
keys. For example `UISupportedInterfaceOrientations~ipad` replaces
`UISupportedInterfaceOrientations` when running on an iPad.

By using Bundle.infoDictionary, Apple will pre-process the Info.plist and replace
any key with its device specific variant. Since AltStore does not support iPad,
this will strip out any iPad specific keys for the installing app.

We add an extension Bundle.completeInfoDictionary that will return the original
de-serialized dictionary including all the device specific keys.

See: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW9

# Conflicts:
#	AltKit/Extensions/Bundle+AltStore.swift
#	AltStore/Model/DatabaseManager.swift
This commit is contained in:
osy
2020-06-10 14:58:25 -07:00
committed by Riley Testut
parent 1d160aeeea
commit 3def65f501
3 changed files with 8 additions and 3 deletions

View File

@@ -109,7 +109,7 @@ private extension ResignAppOperation
{
guard let identifier = bundle.bundleIdentifier else { throw ALTError(.missingAppBundle) }
guard let profile = profiles[identifier] else { throw ALTError(.missingProvisioningProfile) }
guard var infoDictionary = bundle.infoDictionary else { throw ALTError(.missingInfoPlist) }
guard var infoDictionary = bundle.completeInfoDictionary else { throw ALTError(.missingInfoPlist) }
infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier
infoDictionary[Bundle.Info.altBundleID] = identifier
@@ -148,7 +148,7 @@ private extension ResignAppOperation
progress.becomeCurrent(withPendingUnitCount: 1)
guard let appBundle = Bundle(url: appBundleURL) else { throw ALTError(.missingAppBundle) }
guard let infoDictionary = appBundle.infoDictionary else { throw ALTError(.missingInfoPlist) }
guard let infoDictionary = appBundle.completeInfoDictionary else { throw ALTError(.missingInfoPlist) }
var allURLSchemes = infoDictionary[Bundle.Info.urlTypes] as? [[String: Any]] ?? []