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

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

问题描述

我曾在此处提出问题,但答案是答案指导我开一个新话题。不久,我想从我的应用程序在Appstore上启动一个免费的应用程序,但我要启动的应用程序没有网址方案。关于我的另一个问题的评论说使用一些特殊的API,如SBSLaunchApplicationWithIdentifier或类,如 UIDocumentInteractionController 使它成为可能。任何人都可以帮我如何从我的应用程序启动一个应用程序。在此先感谢

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

推荐答案

首先我要说此方法仅限越狱!它使用私有API Apple可以在以后的版本中随时停止支持

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!

让我们来看看,这个方法使用 [UIApplication launchApplicationWithIdentifier:suspended:] 私有方法:

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

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

从我测试过的应用程序调用此方法不以root身份运行没用,显然SpringBoard(或LaunchServices)只允许root应用程序使用这种方法启动其他应用程序。

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.

所以,首先你需要越狱你的iPhone,然后你需要让您的应用程序以root身份运行。

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

要让您的应用程序以root身份运行,您需要将其放在/Applications/YourApp.app而不是通常的/ User /应用/ UUID /YourApp.app。

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.

您可以使用Cydia安装OpenSSH并使用SSH访问手机的shell。

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:

< img src =https://i.stack.imgur.com/i9lsI.pngalt =在此处输入图像说明>

我会使用相同的作为Cydia:

I would use the same ones as Cydia:

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

接下来,一个小技巧。二进制文件需要 setuid位

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

chmod 4755 /Applications/YourApp.app/YourApp

最后一步,SpringBoard不会使用setuid位打开应用程序,但会打开一个脚本(可以打开另一个应用程序)!只需将二进制文件的名称更改为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_

使用以下脚本在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_

现在,只是呼唤(在Cydia有一个应用程序)你就是准备好了。

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

对不起,如果这看起来很难,事实并非如此,我不记得我在哪里学到它,但很久以前。这种方法适用于所有iOS版本,我只是用iOS 5.1进行了测试。

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.

再次,如果你做的话,你的APP将不会被APPLE批准这个

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

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