Get path to iOS application based on name or bundle identifier

前端 未结 3 608
猫巷女王i
猫巷女王i 2021-01-02 22:42

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, h

3条回答
  •  一整个雨季
    2021-01-02 22:58

    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.

提交回复
热议问题