Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

jailbreak - iOS How can I use UIApplication launchApplicationWithIdentifier which is in private APIs?

[EDIT]I've jb my device. And I found the latest private APIs iOS-Runtime-Headers on Github.

I want to use private APIs in my app.

I found kennytm/iphone-private-frameworks on github but it only support iOS 3.x. While I'm working on iOS 5.0.1.

I also found some codes on Google iPhone development tools. But it really make me confused. I'm new to iPhone development.

What should I do to use

[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.a.b" suspended:NO];

Someone can give me a direction or some examples. Thanks a lot.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

REQUIREMENTS

  1. Jailbroken iDevice
  2. Valid certificates/keys in your keychain and its associated provisioning profile. (If you aren't enrolled in the apple developer program, use this workaround: self sign my code and test on iphone in xCode)

MY SOLUTION

1) Enable Entitlements in your XCode project.

To add Entitlements to your project, select your project in project navigator, then on active Target -> Summary -> Entitlements -> check Enable entitlements check box. New file with name "YourProject.entitlements" would appear in project navigator right after.

2) Add folowing property to Entitlements.

Add entitlement property: com.apple.springboard.launchapplications of type Boolean with value YES

3) Since launchApplicationWithIdentifier:suspended: is private API, you need to explicitly declare it in order to build your app. Just add folowing code in appropriate place(s):

// Simply make declaration  inside a Category.
#import "BlahBlah.h"
@interface UIApplication (Undocumented)
    - (void) launchApplicationWithIdentifier: (NSString*)identifier suspended: (BOOL)suspended;
@end
....
@implementation BlahBlah
...

4) Build your project.

5) Copy YourProject.app into device's /Application folder (via SFTP, for example)

6) Respring or reboot iDevice.

7) ...

8) Profit!

SEE ALSO

Special API to launch an app from my application - another solution

What is the bundle identifier of apple's default applications in iOS?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...