开发者

Quit app instead of entering background when receiving applicationDidEnterBackground

开发者 https://www.devze.com 2023-03-05 15:41 出处:网络
I wonder if it开发者_运维知识库\'s possible to quit my program entirely after the user presses the Home button, rather than going into background run mode. Thanks.In your application\'s Info.plist, ad

I wonder if it开发者_运维知识库's possible to quit my program entirely after the user presses the Home button, rather than going into background run mode. Thanks.


In your application's Info.plist, add a boolean key UIApplicationExitsOnSuspend with the value YES. See the Information Property List Key Reference for more information.


Yup!! Although Apple will warn you that they don't want you to do this, it is possible, and I will trust that whatever reasons you have are legitimate. They will not exclude your app from the App Store just because it does not have backgrounding enabled.

In Xcode, find your <-yourappname->-Info.plist file. In Xcode 4, it is located in the "Supporting Files" group. In Xcode 3, it is located in the "Resources" group. Select the last entry and click the "+" icon to add another entry. Type "Application does not run in background" for the key (it will automatically fill this in), and then change the value to "YES".

Good luck with the app!!


Refer to this question and its top voted answer for more information on the matter.


Using an Info.plist property UIApplicationExitsOnSuspend you can prevent your app from entering background and terminating as was the norm prior to iOS 4. You can read more about Info.plist keys to learn about additional options.

If you do not want your application to remain in the background when it is quit, you can explicitly opt out of the background execution model by adding the UIApplicationExitsOnSuspend key to your application’s Info.plist file and setting its value to YES

0

精彩评论

暂无评论...
验证码 换一张
取 消