Force iphone app to restart programmatically?

前端 未结 7 988
北荒
北荒 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 03:46

    Objective-C:

    exit(0);
    

    Swift:

    exit(0)
    

    I have this on 2 live apps and they haven't been rejected. One of my apps even has this line of code as a feature in the home page of my app. Its located at the top right corner, where tweet button is on Twitter. So don't worry about the Apple rejecting unless it looks like an unexpected crash.

提交回复
热议问题