force quit ios app, save data till that instant.

We are developing an iOS app, which requires recording of data that comes over network socket into a file in the media share as one of its features. We would like to know if the following things are possible and if so, then how.

1. Any notification can be obtained when the app is force quit after moving to background.

2. On force closing the app, we would like to write a footer to the data file. Is it possible to get any hook to do this before closing the application.

Replies

We would like to know if the following things are possible and if so, then how.

As KMT said, there’s no direct solution to these problems. Moreover, even if you could deal with the force quit side of things, there are other issues to consider. For example, your app might crash, or the device might kernel panic, or the user might hard restart it. You need to come up with a data consistency mechanism that deals with all of these cases. Most folks address this issue with some sort of journalling approach, but the devil really is in the details here.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"