How to close/exit an iOS app?

For android, I’m using “native.requestexit”, and it’s fine, but my app will run on iOS too, and as I’ve read the documentation, it’s not recommended to use “os.exit” since it will be rejected by the app store, so thanks for the warning, but not a single word next to it to say what I should use to exit/close an app on iOS? that’s just bad form…

Please help someone??

Hi @formatc,

Basically stated, it’s just not good form to force exit an iOS app. This isn’t Corona’s policy, but Apple’s. You can use “os.exit” and maybe the reviewers won’t flag it, but it’s taking a chance either way.

Best regards,

Brent Sorrentino

So technically speaking, the iOS equivalent of exiting an app on android (by clicking the back button, or by native.requestexit) is nothing? no closing of apps? if, for example (only an example) I make an app that loads updates from the server only once, on app start up/load (it’s only an example, come on…), while on android, no problem, I’m done using the app, click back button, or my own exit app button, it closes, all well, I can re open it, it will “update”, but on iOS, strictly speaking, unless the device rebooted, the general idea is the app would only “update” once, in this case?? since we never “close” the app on iOS?? (again, not talking about someone killing the process to force close the app…).

I think what you need to look at is the application suspend/resume events in your case - trigger the update on resume.

check out this tutorial, it’s old but relevant

http://www.coronalabs.com/blog/2012/05/15/handling-corona-system-events/

Hi @formatc,

Basically stated, it’s just not good form to force exit an iOS app. This isn’t Corona’s policy, but Apple’s. You can use “os.exit” and maybe the reviewers won’t flag it, but it’s taking a chance either way.

Best regards,

Brent Sorrentino

So technically speaking, the iOS equivalent of exiting an app on android (by clicking the back button, or by native.requestexit) is nothing? no closing of apps? if, for example (only an example) I make an app that loads updates from the server only once, on app start up/load (it’s only an example, come on…), while on android, no problem, I’m done using the app, click back button, or my own exit app button, it closes, all well, I can re open it, it will “update”, but on iOS, strictly speaking, unless the device rebooted, the general idea is the app would only “update” once, in this case?? since we never “close” the app on iOS?? (again, not talking about someone killing the process to force close the app…).

I think what you need to look at is the application suspend/resume events in your case - trigger the update on resume.

check out this tutorial, it’s old but relevant

http://www.coronalabs.com/blog/2012/05/15/handling-corona-system-events/