【问题标题】:iOS How can I use UIApplication launchApplicationWithIdentifier which is in private APIs?iOS 如何使用私有 API 中的 UIApplication launchApplicationWithIdentifier?
【发布时间】:2014-01-29 05:48:16
【问题描述】:

[编辑]我有我的设备。我在 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];

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

【问题讨论】:

    标签: ios jailbreak uiapplication iphone-privateapi


    【解决方案1】:

    要求

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

    我的解决方案

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

    要向您的项目添加权利,请在 项目导航器 中选择您的 项目,然后在活动目标 -> 摘要 -> 权利 -> 选中启用权利复选框。名称为“YourProject.entitlements”的新文件将立即出现在项目导航器中。

    2) 将以下属性添加到权利。

    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) 重新启动或重启iDevice。

    7) ...

    8) 利润!

    另见

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

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

    【讨论】:

    • 我已经 jb 我的设备。我将此密钥添加到 /Supporting Files/myAppName-Info.plist 然后构建它。我像以前一样收到消息。接收器类型“UIApplication”例如消息未声明带有选择器“launchApplicationWithIdentifier:suspended:”的方法。
    • 不在 info.plist 中。在权利中。还要检查我的 UPD,还有另一种可能有用的解决方案
    • 我正在开发 iOS 5 和 Xcode 4.2。官方文档说从 iOS4 开始不再需要 entitlements.plist。所以我不知道我应该在哪里找到这个文件并将这些行添加到它。但是在shell中使用'codesign -d --entitlements -xxxx/Build/Products/Debug-iphoneos/MyApp.app',我可以看到entitlements.plist。我对iOS开发真的很陌生。对不起。现在我正在尝试使用您的 UPD。但是使用'launchApplicationWithIdentifier',项目仍然无法编译成功。谢谢。
    • 我在 XCode 4 中添加了如何为您的项目添加权利的信息。是的,权利不是必需的,因为在某些情况下仍然需要 XCode。我认为它们对 iCloud 很有用,但我不确定。
    • 希望你能成功,用那个或另一个解决方案。无论如何我会检查我的解决方案(周一)。
    猜你喜欢
    • 2022-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-06
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 2018-01-29
    相关资源
    最近更新 更多