开发者

UIApplicationExitsOnSuspend changeable in-app?

开发者 https://www.devze.com 2023-02-16 19:03 出处:网络
Ok, so we all are aware (or should be) that \'U开发者_如何学PythonIApplicationExitsOnSuspend\' can be set true or false in the info.plist file.

Ok, so we all are aware (or should be) that 'U开发者_如何学PythonIApplicationExitsOnSuspend' can be set true or false in the info.plist file.

What I would like to know please, if possible, is if we can change the bool value of UIApplicationExitsOnSuspend in app.

Simply allowing the user to set whether the app is allowed to run in background, or wether it should just kill itself on the pressing of the home button.

Any help please.


It's not possible to change the value in the app.

However you could add a setting to your app and check wheter it's on/off in applicationDidEnterBackground:.
Something like:

if (theUserDoesNotWantMultitasking) {
    exit(0); // doesn't generate a crash report.
}

It seems tolerated by Apple validation process even though I bet they're not recommending it.

Small precision:
By tolerated, I mean that I've done that once in an app, with a different use case (not based on a user setting). It has been approved, but I can't guarantee that it will always be the case.


It's not possible.

Calling exit from your app is going against Apple's advice. If you do so, you may find your app rejected at some future point.

Read the best practices: http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/UEBestPractices/UEBestPractices.html

0

精彩评论

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