Skype 更新文本包含下一个:
如果意外关闭,应用程序会自动重启
如何通过 SDK 执行该操作?
As far as I know, some sort of apps can be run in background and can be restarted in specific case. This is from Apple docs
If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location event.
My opinion is: Skype is relaunched with remote notifications mechanism.
Update
Well, I think I found something. @Malek_Jundi was half-right. Your app should fail with non-zero exit code, but it should be registered as VoIP application.
Because VoIP applications need to stay running in order to receive incoming calls, the system automatically relaunches the application if it exits with a nonzero exit code. (This could happen in cases where there is memory pressure and your application is terminated as a result.) However, terminating the application also releases all of its sockets, including the one used to maintain the VoIP service connection. Therefore, when the application is launched, it always needs to create its sockets from scratch.
Skype 正是这样做的:
据我所知,它不可能重新启动您的应用程序..您可以使用杀死您的应用程序,exit(1);
但这是 Apple 不允许的,将被拒绝。也许您可以通过从 mainViewController 中删除一些视图并再次添加它并重置数据和内容来做一些解决方法.. 但是我不这么认为要真正重新启动。
不确定 Skype 有什么问题,但是 - 不幸的是,无法重新启动应用程序。甚至,没有办法退出/退出应用程序。(要退出,请参阅此链接部分“不要以编程方式退出”)
问题是你为什么要这样做?,如果你的答案是:你想让一个应用程序在“iPad Kiosk”中运行,所以万一它崩溃了,你需要应用程序自动重启,那么,什么对你有用将 iPad 置于“ Kiosk 模式”,操作系统会在崩溃时自动重新启动应用程序。
看一眼:
http://www.webascender.com/Blog/ID/447/How-to-Setup-Kiosk-Mode-Lock-Your-iPad-to-Just-One-App
干杯,