简体   繁体   English

当应用程序进入后台时关闭它

[英]Close the application when it goes to the background

When the application is sent to the background, i need the application to shutdown completely. 当应用程序发送到后台时,我需要应用程序完全关闭。 Presently, when my app goes to the background, and when i call it back it shows the view i was working before it went to the background. 目前,当我的应用程序进入后台时,当我回拨它时,它会显示我在前往后台之前工作的视图。

I am doing this to release memory. 我这样做是为了释放记忆。

How can i do this programatically ? 我怎么能以编程方式执行此操作?

Add a key UIApplicationExitsOnSuspend to YES on info.plist 在info.plist上将关键字UIApplicationExitsOnSuspend添加到YES

More info here 更多信息在这里

https://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html https://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

转到您的配置(例如plist文件)并添加以下标记: UIApplicationExitsOnSuspend并将其设置为true

Do not prevent your app from multitasking just because you have memory issues. 不要因为您遇到内存问题而阻止您的应用程序进行多任务处理。 What you should do is optimize your code and correct these issues. 您应该做的是优化代码并纠正这些问题。

Look at this guide and the methods that it mentions, they will allow you to know if your application is going to the background for example so that you can release some memory. 查看本指南及其提及的方法,它们将允许您知道您的应用程序是否以后台为例,以便您可以释放一些内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 进入后台时退出应用程序 - Exiting an application when it goes to the background 当应用程序进入后台时,是否可以调用webRequest? - Is it possible to call webRequest when application goes in background? 应用程序进入后台时播放MPMoviePlayer - MPMoviePlayer play on when application goes Background 当应用程序进入后台时,MPMoviePlayer会在来电时播放 - MPMoviePlayer play on when application goes Background when incoming call is coming 当 iOS 应用程序进入后台时,冗长的任务是否暂停? - When an iOS application goes to the background, are lengthy tasks paused? 要在应用程序进入后台时保持AVPlayer播放 - want to keep AVPlayer playing when application goes to background ModalViewController在应用程序启动时进入后台 - ModalViewController goes to background on application start 在应用程序进入后台之前执行UI操作 - Perform UI operations before application goes into background 当我的应用程序进入后台时,为什么我的无限UIView动画会停止? - Why does my indefinite UIView animation stop when my application goes to the background? 应用程序从后台状态到前台时的 OpenTok 视频通话问题 - OpenTok Video Call Issue when application goes from background state to foreground
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM