在IOS上使用launchd重启app [英] Using launchd on IOS to restart app

查看:1388
本文介绍了在IOS上使用launchd重启app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在博物馆展览中使用一些iPad,运行由他人开发的应用程序。即使我们已经覆盖了主页按钮,我发现应用程序偶尔会崩溃,让用户处于主屏幕。从这里他们可以访问其他未经授权的应用

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.

博物馆不反对越狱iPad,如果能给我们提供我们需要的解决方案,那么我一直在研究如何将keepd与KeepAlive一起使用标记并将.plist文件放入/ Library / LaunchAgents目录以防止应用程序关闭或重新生成它如果崩溃

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

到目前为止,我已成功制作它使用iPad附带的默认应用程序以及Cydia安装的应用程序,但我无法重启我们想要的应用程序。我已经从/ User / Applications目录和/ Applications中尝试过它,有人建议可能会有所作为,但没有乐趣。有人可以建议一个可能的解决方案,还是我在浪费时间?我从下面的plist文件中插入了XML。

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>


推荐答案

这不起作用,因为App Store应用程序未保存在Applications文件夹中。我可以想到两个选项。

This won't work because App Store applications are not kept in the Applications folder. I can think of two options.


  1. 在Cydia中安装AppLinks。这将创建每个App Store应用程序的符号链接,并将它们放在/ var / mobile / AppLinks中。然后在plist文件中将路径放到应用程序中

  1. 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

除了按常规方式将应用程序安装到iPad上外,您还可以从Xcode获取ipa并解压缩.app软件包。然后手动将其安装到/ Applications /中,你就可以按照你的方式使用你的启动plist。

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.

我推荐第一个选项,因为它允许您更新应用程序而无需手动将.app包放入Applications文件夹。使用第一个选项根本不会改变更新应用程序的工作流程。

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.

另外,请注意,如果这样做,则必须删除在更新应用程序以退出之前plist,因为我不认为您可以在应用程序运行时更新它。

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上使用launchd重启app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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