我必须实现哪些用于多任务处理的新应用程序委托方法才能保留旧行为?
目前我不想关心多任务处理。我的应用程序背后有一个很长的开发旅程,现在它已经被设计成当用户点击主页按钮时,应用程序就会被杀死。当他回来时,该应用程序看起来就像他离开时一样。
如果我想恢复同样的行为,我必须在应用程序委托中实现哪些方法?我假设我必须处理我的应用程序成为后台应用程序的情况,就像按下主页按钮一样,即调用 applicationWillTerminate 时。这是最简单的方法,对吧?
For the moment I don't want to care about multitasking. My app has a very long development trip behind it, and now it has been engineered that way that when the user hits the home button, the app gets killed. When he comes back, the app appears like he left it.
If I wanted to get this same behavior back, which methods would I have to implement in the app delegate? I assume that I would have to treat the case where my app becomes a background app just like if the home button was pressed, i.e. if applicationWillTerminate was called. That would be the simplest way, right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在
Info.plist
文件中将名为UIApplicationExitsOnSuspend
的布尔标志设置为YES
。当您这样做时,当用户点击主页按钮时,-applicationWillTerminate
将像平常一样被调用。You need to set a boolean flag in your
Info.plist
file calledUIApplicationExitsOnSuspend
toYES
. When you do so, when the user hits the home button,-applicationWillTerminate
will get called, as normal.在 Info.plist 中将
UIApplicationExitsOnSuspend
设置为YES
。不过,您的客户会讨厌您的应用程序,因为它不支持快速应用程序切换。Set
UIApplicationExitsOnSuspend
toYES
in your Info.plist. Your customers will hate your app for not supporting fast app switching, though.在 Info.plist 中包含
UIApplicationExitsOnSuspend
键。请参阅 此了解更多信息。Include the
UIApplicationExitsOnSuspend
key in your Info.plist. See this for more information.