简体   繁体   中英

How to get applicationWillTerminate Notification for an iOS App that has Backgrounding Enabled?

So I'm aware that applicationWillTerminate: will not be called if your app supports background execution (unless there's some memory issue), and applicationDidEnterBackground: is called instead.

Inside of the applicationDidEnterBackground: method in the appDelegate, it says

// If your application supports background execution, 
//this method is called instead of applicationWillTerminate: when the user quits.

However, I need to save some entries into a dictionary when the user actually quits the app. I do not want to do this every time the app enters the background though. Is there a way to get the termination notification even though my app supports backgrounding?

Specifically if the app is force quit by the user, what is some sort of workaround to get a notification of this?

save every time the app enters into the bg. the os may THEN kill you without any further warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM