开发者

To restart the app from the home screen and not from the screen we left at

开发者 https://www.devze.com 2023-02-06 07:48 出处:网络
When we play our app on the device(ios 4.0 and above) and leave mid workflow, and return later, we return mid workflow.I want that it should not replay from the same left point rather the main screen

When we play our app on the device(ios 4.0 and above) and leave mid workflow, and return later, we return mid workflow. I want that it should not replay from the same left point rather the main screen should load(i.e, the same thing that happens o开发者_StackOverflown calling viewDidLoad of our rootViewController).

Please give suggestions if it is possible and if not then please post the reason behind that.


Here's an alternative approach, disable background mode and restart your app every time it enters the foreground: add UIApplicationExitsOnSuspend key to your app's info.plist and set its value to YES.

UIApplicationExitsOnSuspend

UIApplicationExitsOnSuspend (Boolean - iOS) specifies that the application should be terminated rather than moved to the background when it is quit. Applications linked against iOS SDK 4.0 or later can include this key and set its value to YES to prevent being automatically opted-in to background execution and application suspension. When the value of this key is YES, the application is terminated and purged from memory instead of moved to the background. If this key is not present, or is set to NO, the application moves to the background as usual.

This key is supported in iOS 4.0 and later.


So actually you want to quit the app on Home button press and restart?i.e turn multitasking off?
Search for info on UIApplicationExitsOnSuspend


Yes you call your rootviewcontroller from applicationDidUnhide to do so. You'll have to twist your logic a little (have to reset your variables on this method call).

Edit: You should instead use applicationDidBecomeActive. Reference is on same link.

0

精彩评论

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

关注公众号