gpt4 book ai didi

ios - 如何在 iOS 上通过 bundle id 打开应用程序

转载 作者:行者123 更新时间:2023-11-29 02:00:01 39 4
gpt4 key购买 nike

刚才,我在Xcode6.3.1上创建了一个基于Single View Application的项目,然后在Main.storyboard上创建了一个按钮。触摸按钮时的代码是这样的:

NSString * bundleId = @"com.apple.iBooks";
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) = dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
const char *strBundleId = [bundleId cStringUsingEncoding:NSUTF8StringEncoding];
int result = SBSLaunchApplicationWithIdentifier((__bridge CFStringRef)bundleId, NO);
dlclose(sbServices);

但是没有用。然后我喜欢这个网站告诉我,Launch other application without URL schema in iphone?它也没有用。请帮我。我的设备是iPhone4s,iOS 7.1.2,越狱。

最佳答案

* 对于越狱,您可以继续执行此操作 *

有一种称为 URL 方案 的机制,可用于从应用程序内部打开应用程序。但为此,您需要在 plist 文件中进行正确的 url 方案设置。我强烈感觉到您没有考虑这个选项。

* 还有另一种严格不推荐的方法(JAILBREAK PHONES 除外)API 是私有(private)的 *,但您可以在开发模式下尝试并享受。

  • openApplicationWithBundleID:使用包标识符打开应用程序。
  • - (NSArray*)allInstalledApplications;:这将列出您设备上所有已安装的应用程序。

如果你想看一个有趣的演示,请 run this app在您的手机中并查看 Apple Watch 样式、跳板,其中列出了所有应用程序并且可以在点击时启动。

希望能更好地了解私有(private) api 的用法。

关于ios - 如何在 iOS 上通过 bundle id 打开应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30476982/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com