iOS如何使用私有API中的UIApplication launchApplicationWithIdentifier?

时间:2012-06-15 08:32:24

标签: ios jailbreak uiapplication iphone-privateapi

[编辑]我是jb我的设备。我在Github上找到了最新的私有API iOS-Runtime-Headers

我想在我的应用中使用私有API。

我在github上找到了kennytm/iphone-private-frameworks,但它只支持iOS 3.x.我正在使用iOS 5.0.1。

我还在Google iPhone开发工具上找到了some codes。但它确实让我感到困惑。我是iPhone开发的新手。

我应该怎么做才能使用

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

有人可以给我一个方向或一些例子。非常感谢。

1 个答案:

答案 0 :(得分:5)

要求

  1. Jailbroken iDevice
  2. 钥匙串中的
  3. 有效证书/密钥及其关联的配置文件。 (如果您未注册Apple开发人员计划,请使用此解决方法:self sign my code and test on iphone in xCode
  4. 我的解决方案

    1)在您的XCode项目中启用权利

    要向项目添加权利,请在项目导航器中选择项目,然后在有效目标上选择> 摘要 - > 权利 - >选中启用权利复选框。名为“ YourProject.entitlements ”的新文件将立即显示在项目导航器中。

    2)将以下属性添加到Entitlements。

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

    3)由于launchApplicationWithIdentifier:suspended:私有API ,您需要明确声明它以构建您的应用。只需在适当的位置添加以下代码

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

    4)构建您的项目。

    5)将 YourProject.app 复制到设备的 / Application 文件夹中(例如,通过SFTP)

    6) Respring 或重启iDevice。

    7)...

    8)利润!

    另请参见

    Special API to launch an app from my application - 另一种解决方案

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