用于从我的应用程序启动应用程序的特殊 API [英] Special API to launch an app from my application

查看:21
本文介绍了用于从我的应用程序启动应用程序的特殊 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在:

chmod 4755/Applications/YourApp.app/YourApp

最后一步,SpringBoard 不会打开带有 setuid 位的应用程序,而是打开一个脚本(可以打开另一个应用程序)!只需将二进制文件的名称更改为类似 YourApp_ 的名称:

mv/Applications/YourApp.app/YourApp/Applications/YourApp.app/YourApp_

并使用以下脚本在您的应用文件夹中创建一个名为 YourApp 的新文件:

#!/bin/bashCrrDir=$(目录名$0")exec "${CrrDir}"/YourApp_

现在,只需重新启动(Cydia 中有一个应用程序),您就可以开始了.

对不起,如果这看起来很难,其实并不难,我不记得我在哪里学的,但那是很久以前的事了.这种方法适用于所有 iOS 版本,我刚刚在 iOS 5.1 上对其进行了测试.

同样,如果您这样做,您的应用将不会得到 Apple 的批准.

I had asked a question here but the answer guide me to open a new topic. Shortly, i want to launch a free app on Appstore from my application but the app i want to launch has no URL Scheme. The comments on my other question say using some special APIs like SBSLaunchApplicationWithIdentifier or classes like UIDocumentInteractionController make it possible. Can anyone please help me how to launch an application from my appication. Thanks in advance

解决方案

Let me first say that this method is jailbreak only! It uses private API's that Apple can stop supporting at any time in a future version!

Let's get to it, this method uses the [UIApplication launchApplicationWithIdentifier:suspended:] private method:

[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.apple.Preferences" suspended:NO];

From what I've tested calling this method from an application not running as root is useless, apparently SpringBoard (or LaunchServices) only allow root applications to launch other applications using this method.

So, first you need to jailbreak your iPhone, then you need to get your application running as root.

To get your app running as root you need to place it in /Applications/YourApp.app instead of the usual /User/Applications/UUID/YourApp.app.

You can install OpenSSH using Cydia and use SSH to access your phone's shell.

Then, after having your app in the right place you need to set permissions, for example:

I would use the same ones as Cydia:

chown -R root:wheel /Applications/YourApp.app

Next, a little trick. The binary will need the setuid bit:

chmod 4755 /Applications/YourApp.app/YourApp

And for the last step, SpringBoard doesn't open apps with the setuid bit, but it opens a script (which can open another app)! Just change the name of the binary to something like YourApp_:

mv /Applications/YourApp.app/YourApp /Applications/YourApp.app/YourApp_

And create a new file named YourApp in your app folder with the following script:

#!/bin/bash
CrrDir=$(dirname "$0")
exec "${CrrDir}"/YourApp_

Now, just respring (there's an app for that in Cydia) and you're ready to go.

Sorry if this seems hard, it isn't, I don't remember where I learned it, but it was a long time ago. This method works fine in all iOS versions and I've just tested it with iOS 5.1.

Again, YOUR APP WILL NOT BE APPROVED BY APPLE IF YOU DO THIS.

这篇关于用于从我的应用程序启动应用程序的特殊 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆