如何快速从越狱的iOS设备上的捆绑ID获取应用程序的目录?
在iOS设备中,所有用户应用程序都位于/var/mobile/Applications
目录中,每个应用程序都有唯一的随机uuid作为其目录名称,例如:
/var/mobile/Applications/15FD62FD-2BEB-4C1E-A9B8-BC93E5C721CC
uuid是15FD62FD-2BEB-4C1E-A9B8-BC93E5C721CC
。
现在我想通过应用程序的包标识符来获取目录,我的解决scheme是枚举/var/mobile/Applications
目录,从Info.plist
获取包标识符并检查。
这个解决scheme相当慢,有没有更快的方法来做到这一点?
例如,如果有一个plistloggingbundle id到uuid映射,那么我可以读取该文件以避免目录枚举。
我认为你正在寻找的文件是
/var/mobile/Library/Caches/com.apple.mobile.installation.plist
例如,它包含每个应用程序的信息:
"com.zillow.ZillowMap" = { ApplicationDSID = 216284405; ApplicationType = User; CFBundleDisplayName = Zillow; CFBundleExecutable = ZillowMap; CFBundleIconFiles = ( "app-icon", "app-icon-iPad.png", "app-icon-iPad@2x.png" ); CFBundleIcons = { CFBundlePrimaryIcon = { CFBundleIconFiles = ( "app-icon", "app-icon-iPad.png", "app-icon-iPad@2x.png" ); UIPrerenderedIcon = 1; }; }; CFBundleIdentifier = "com.zillow.ZillowMap"; CFBundleName = ZillowMap; CFBundleShortVersionString = "6.1.0112"; CFBundleVersion = "6.1.0112"; CodeInfoIdentifier = "com.zillow.ZillowMap"; Container = "/private/var/mobile/Applications/B9284FBE-E558-4A65-A7E4-AE20CDAD9A1D"; Entitlements = { "application-identifier" = "JEWMY3RZ4A.com.zillow.ZillowMap"; "aps-environment" = production; }; EnvironmentVariables = { "CFFIXED_USER_HOME" = "/private/var/mobile/Applications/B9284FBE-E558-4A65-A7E4-AE20CDAD9A1D"; HOME = "/private/var/mobile/Applications/B9284FBE-E558-4A65-A7E4-AE20CDAD9A1D"; TMPDIR = "/private/var/mobile/Applications/B9284FBE-E558-4A65-A7E4-AE20CDAD9A1D/tmp"; }; IsUpgradeable = 1; LSRequiresIPhoneOS = 1; MinimumOSVersion = "5.0"; Path = "/private/var/mobile/Applications/B9284FBE-E558-4A65-A7E4-AE20CDAD9A1D/ZillowMap.app"; SequenceNumber = 2618; SignerIdentity = "Apple iPhone OS Application Signing"; UIDeviceFamily = ( 1, 2 ); UIPrerenderedIcon = 1; };
更新
这个文件在iOS 8中被删除:( https://www.theiphonewiki.com/wiki/Com.apple.mobile.installation.plist )
在/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist
存在一个类似的iOS 8文件,但只能在启动时重新启动(重新启动)。
如果您的代码在SpringBoard中运行,这里是另一个解决scheme:
NSString *applicationBundleIdentifier = @"..."; SBApplication *application = [[SBApplicationController sharedInstance]applicationWithDisplayIdentifier:applicationBundleIdentifier]; NSString *path = application.containerPath;