I have an iOS app and for several reasons I need to close it when the user clicks the home button of the device. I can't support background.
I now there is an option called Application does not run in background
, but I can't use it because there is a bug from Facebook sdk that makes impossible to authenticate with Facebook when this option is in use. Here is the bug report at Facebook.
So I don't know what to do, how can I restart it? An [[NSThread mainThread] exit]
in applicationDidEnterBackground
?
Is there a workaround for this?
The legal (Apple will approve the app) way is set or create the key UIApplicationExitsOnSuspend
to YES
in the Info.plist
.
To get this as action you would need exit(0)
or [[NSThread mainThread] exit]
, but this is against the Human Interface Guidelines from Apple
So what you could also do is just design all your views in a manner that they have a reset function . Then when applicationDidEnterBackground
store that you need to reset on next startup or directly call reset on all active views in applicationWillEnterBackground
So your App didn't really restart, but all your views look like this. To give you an advice, I would design my app in a manner that it doesn't shutdown itself when i quit. This is no good user experience.. Once clicked the home button and all your data is away, same when you receive a call.