Forcing a background application to terminate in iOS simulator

前端 未结 1 595
温柔的废话
温柔的废话 2021-01-16 11:28

In iOS 4 applications go to the background instead of terminating. For this reason I have to register for:

[[NSNotificationCenter defaultCenter] addObserver:         


        
相关标签:
1条回答
  • 2021-01-16 11:35

    If you want to test the reception of such a notification, add following key to your Info.plist file: Application does not run in background and set it to YES. The internal name is <key>UIApplicationExitsOnSuspend</key>.

    This will tell iOS and the simulator, that your application wants to terminate rather than being sent to background when the home button is pressed. In this case, the UIApplicationWillTerminateNotification is sent.

    For testing, this should suffice.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题