在IOS上使用launchd重启应用程序
我在博物馆展览中使用一些 iPad,运行其他人开发的应用程序。尽管我们已经介绍了“主页”按钮,但我发现应用程序偶尔会崩溃,使用户留在主屏幕上。从这里他们可以访问其他未经授权的应用程序。
博物馆并不反对越狱 iPad,只要这能为我们提供所需的解决方案,因此我一直在研究使用带有 KeepAlive 标签的 launchd 并将 .plist 文件放入 /Library/LaunchAgents 目录中的想法阻止应用程序关闭或在崩溃时重新生成它
到目前为止,我已经成功地使其与 iPad 附带的默认应用程序以及 Cydia 安装的应用程序一起使用,但我无法让它重新启动我们需要的应用程序 想。我已经从 /User/Applications 目录和 /Applications 尝试过,有人建议这可能会有所不同,但没有什么乐趣。有人可以建议一个可能的解决方案还是我在浪费时间?我已从下面的 plist 文件中插入了 XML。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.MVFieldguide.launchd</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Field Guide 2010.app/Field Guide 2010</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>
I am using some iPads in a museum exhibition, running an app developed by others. Even though we've covered the Home button, I'm finding that occasionally the app crashes, leaving the user at the Home screen. From here they can access other unauthorised apps.
The museum is not averse to jailbreaking the iPad if that will give us the solution we require, so I have been doing some research into the idea of using launchd with the KeepAlive tag and putting the .plist file into the /Library/LaunchAgents directory to prevent the app closing or re-spawning it if it crashes
So far I have had success making it work with the default apps that come with the iPad and also Cydia installed apps but I can't get it to restart the app that we want. I have tried it from the /User/Applications directory and also /Applications, which someone suggested might make a difference but no joy. Can someone suggest a possible solution or am I wasting my time? I've inserted the XML from my plist file below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.MVFieldguide.launchd</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Field Guide 2010.app/Field Guide 2010</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不起作用,因为 App Store 应用程序不保存在“应用程序”文件夹中。我可以想到两个选择。
在 Cydia 中安装 AppLinks。这将创建每个 App Store 应用程序的符号链接并将它们放入 /var/mobile/AppLinks 中。然后在您的 plist 文件中将应用程序的路径设置为
/var/mobile/AppLinks/Field Guide 2010/Field Guide 2010
您可以获取从 Xcode 中下载 ipa 并提取 .app 包。然后手动将其安装到 /Applications/ 中,您就可以按照自己的方式使用 launchd plist。
我推荐第一个选项,因为它允许您更新应用程序,而无需手动将 .app 捆绑包放入“应用程序”文件夹中。使用第一个选项根本不会改变您更新应用程序的工作流程。
另外,请注意,如果您这样做,则必须在更新应用程序之前删除 plist 以退出它,因为我认为您无法在应用程序运行时更新它。
This won't work because App Store applications are not kept in the Applications folder. I can think of two options.
Install AppLinks in Cydia. This will create symlinks of every App Store app and puts them in /var/mobile/AppLinks. Then in your plist file put the path to the application as
/var/mobile/AppLinks/Field Guide 2010/Field Guide 2010
Instead of installing the app onto the iPad conventionally, you can get the ipa from Xcode and extract the .app bundle. Then manually install it into /Applications/ and you'll be able to use your launchd plist the way you have it.
I recommend the first option because it will allow you update the app without manually putting the .app bundle into the Applications folder. Using the first option won't change your workflow for updating the app at all.
Also, just be aware that if you do this, you'll have to remove the plist before updating the app to quit it, as I don't think you can update an app while it's running.
iOS 6.0 可能有某种修复将设备锁定到某种模式...我不知道(NDA)
被黑的 iOS 5.1 仍然可以执行以下操作:
使用捆绑包标识符使用应用程序...
您可以打开带有 com.apple.calculator 的计算器...不需要文件夹!
这是您放入 launchd 文件夹中的脚本...
首先从 cydia 安装 Open 应用程序,以便您可以使用“open com.apple.calculator”终端命令
iOS 6.0 may have some kind of fix for locking the device into a mode... I DON"T KNOW (NDA)
a hacked iOS 5.1 can still do the following:
user the app with the bundle identifier....
you can open calculator with com.apple.calculator.... no need for folders!
here is the script you put into launchd folder...
Install the Open app from cydia first so you can use the "open com.apple.calculator" terminal command