作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
刚才,我在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/
我是一名优秀的程序员,十分优秀!