Force iphone app to restart programmatically?

前端 未结 7 870
北荒
北荒 2020-11-27 03:28

I am trying to get my iPhone app to restart programmatically when the Logout button is pressed.

Has anyone got a code sample to share? I\'ve read that it is possible

相关标签:
7条回答
  • 2020-11-27 04:10

    I exit during -applicationWillResignActive: if the app is on the start screen and Apple has accepted it for years. To the user it will not look like a crash. Next time the user starts the app from the icon. An additional check that does not quit the app if it was launched today could be useful for the user-experience in some cases.

    - (void)applicationWillResignActive:(UIApplication *)application
    {
        // called if phone-call comes in!
        if([gameController isGameFinished])
            exit(0);
    }
    
    0 讨论(0)
提交回复
热议问题