I'm trying to write an app for jailbroken iOS devices that can load files from another app. But appstore apps are stored in folders with seemingly random characters that vary per device. How can I figure out the directory for X app on the device? On iOS 8, achieving this seems harder due to the way the app filesystem is structured.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- What file sytems support Java UserDefinedFileAttri
iOS 7 and below
AppStore apps are installed in
/var/mobile/Applications
inside directory with random name. App's directories (documents, library etc) and *.app directory are both inside it. To determine which app it is you need to parseInfo.plist
file inside *.app directory where app name and bundle identifier are stored.iOS 8
Apple completely changed the way AppStore apps are stored in filesystem. Everything we need now is in
/var/mobile/Containers
directory - at this point every directory I mention further down the text is contained inside that directory. All bundles (anything that contains application code) are stored inBundle
directory. There you will find apps, plugins and may be some other stuff.For example, OpenVPN application contains two bundles with application code -
OpenVPN.app
with application executable andOpenVPNPlugin.vpnplugin
which implements OpenVPN protocol as iOS VPN plugin.OpenVPN.app
is inApplications
directory andOpenVPNPlugin.vpnplugin
is inVPNPlugin
. For some reasonOpenVPNPlugin.vpnplugin
is also stored inApplications
but it looks like it's a temporary measure for compatibility reasons.All application data now stored in
Data
directory. Applications, plugins store their data inside that directory.Apps directories (documents, library etc) now stored in
Data/Application
inside directory with random name. To determine which app directories it is you need to parseData/Application/xx-xx-xx/.com.apple.mobile_container_manager.metadata.plist
. Inside it you will findMCMMetadataIdentifier
key that contains app's bundle identifier.There are also
Data/PluginKitPlugin
andData/VPNPlugin
directories on my device. Again, parseData/PluginKitPlugin/xx-xx-xx/.com.apple.mobile_container_manager.metadata.plist
andData/VPNPlugin/xx-xx-xx/.com.apple.mobile_container_manager.metadata.plist
respectively. Inside it you will findMCMMetadataIdentifier
key that contains plugin's bundle identifier. In case of PluginKitPlugin, to determine to which app it belongs you need to go to*.app
. It seems PluginKitPlugin bundles are stored in*.app/PlugIns
. Parse it'sInfo.plist
to determine plugin's bundle identifier. As an example you can look at how Evernote is stored.And finally there is
Shared
directory. It seems it contains app's documents that can be shared between different apps. Again, insideShared
you will find directory with random name. To determine which app shared that documents parse the.com.apple.mobile_container_manager.metadata.plist
.MCMMetadataIdentifier
will containgroup.
string concatenated with app's bundle identifier.iOS 8 Update
Since iOS 8.4 Apple once again changed things. Now there are no
.com.apple.mobile_container_manager.metadata.plist
files. Instead you need to parse/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist
. It holds information about all installed applications (even system ones) since iOS 8 so you actually don't need.com.apple.mobile_container_manager.metadata.plist
at all.The plist has a very simple structure. First is dictionary with two main keys
Those dictionaries use bundle identifier as key and dictionary with application info as value. For example:
iOS 9 Update
It looks like both
.com.apple.mobile_container_manager.metadata.plist
and/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist
are too unreliable. The former is once again present in iOS 9 - don't know what happened in 8.4, maybe a bug. The latter is not always up-to-date. In fact, most of the time it contains old information. Especially for application sandbox path. Looks like it does change periodically as many times I found that the plist gives me the wrong path.There is a much more reliable solution that doesn't require fiddling with plists or anything -
LSApplicationWorkspace
fromMobileCoreServices
framework. It has method- (id)allInstalledApplications
that returns an array ofLSApplicationProxy
objects that will give you all the information you might find inLastLaunchServicesMap.plist
. And, if I remember correctly, it works even without jailbreak.