Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get path to iOS application based on name or bundle identifier

Is there an easier way to get the path to an iOS application, than searching /var/mobile/Applications?

I know both the name and the bundle identifier, however the path is not consistent on different iOS devices.

This is for use in a jailbreak tweak, so I can use PrivateFrameworks and other code not allowed by Apple.

like image 900
Tyilo Avatar asked Mar 24 '12 22:03

Tyilo


People also ask

What is the difference between app ID and bundle ID in iOS?

An App ID is a string used to identify one or more apps from a single development team. The string consists of two parts, the Team ID and the bundle ID separated by a period (.). The Team ID is supplied by Apple, while the bundle ID is supplied by the developer.

What does bundle identifier do?

What is a Bundle or Application ID? In the Apple App Store, the Bundle ID serves as a resource that represents the app's unique identifier that you can register, modify, and delete.

What is a bundle identifier Apple?

The bundleIds resource represents the app's unique identifier that you can register, modify, and delete. You need a bundle ID before you can assign capabilities with the Bundle ID Capabilities resource or create a provisioning profile with the Profiles resource.


2 Answers

If running in an app, you can define:

extern NSString* SBSCopyBundlePathForDisplayIdentifier(NSString* bundleId);

and link to the SpringboardServices framework.

like image 25
malhal Avatar answered Sep 22 '22 11:09

malhal


If you're running code that executes in Springboard, this should be fairly simple. Get SBApplicationController's sharedInstance, then get the SBApplication you're looking for with the applicationWithDisplayIdentifier: method (or using whatever method you choose). The SBApplication class contains properties for path, containerPath, and bundle (among many others), one of which should be what you're looking for. I haven't tried this myself, so I can't guarantee it'll work, but based on a quick glance at the Springboard header files (you can take a look here, or dump the header files yourself), it should work.

On the other hand, if you're not running from Springboard (ie. if you're making an actual App Store-style application), then you may be out of luck. You could look into inter-process communication with Springboard and see if something can be done there, but it'd probably be more trouble than it's worth.

like image 62
Andrew R. Avatar answered Sep 21 '22 11:09

Andrew R.