I see in the documentation that this call is preferred over os.exit(), however, it says that the function is not supported on iOS.
What options would you have for a similar feature on iOS?
I see in the documentation that this call is preferred over os.exit(), however, it says that the function is not supported on iOS.
What options would you have for a similar feature on iOS?
I’m not 100% sure about this, but I think you’re not supposed to force kill an app from within on iOS. i.e. For some reason I thought this was a design guidelines.
If not, however, os.exit() would still kill the app. I would simply do it AFTER warning the user and giving them an option not to exit.
Why do you need to forcibly exit?
As as SSK user you could do this:
-- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/system/ -- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/misc/#easyalert local function doExit() if( oniOS ) then os.exit() else native.requestExit() end end ssk.misc.easyAlert( "Exit?", "Do you wish to exit?", {{"Yes", doExit}, {"No"}} )
I was not asking if I need to forcibly exit, just wanted to see what to do about iOS. Also, thank you for the snippet, I will try it out.
Your question implies you’re going to call an exit function.
This is forcibly exiting / killing the app.
Why do you need to do this?
I am asking because I am curious and I always like to know the root of a question so I can give the best possible answer.
Often times people ask the question they want solved and don’t present to reason they think that is the right question.
If folks presented the cause of their question earlier in the discussions, they would often get better help and better end results.
I’m saying this for future readers. Right now, I’m just curious.
Thanks, just tested this with Live Build, works great!
I did not intend for my question to sound like I was trying to quit forcibly. Sorry for the confusion. Just wanted to make sure my game encompasses functionality for both Android and iOS.
So you’re not calling either function and you were just curious about them?
There are times where you don’t want iOS to act like Android and this is one of them. On Android, it’s somewhat acceptable for the back button to eventually lead back to the main menu and then if pressed again, exit (or ask the user if they intended to exit before actually exiting). On iOS, this is forbidden behavior. iOS doesn’t have a back button. Apps, per Apple’s design guidelines, should never exit intentionally.
If you want your app to behave as they should, you’re going to have them behave differently in this case.
Rob
Wait, so if I had a quit button, but it asks a user a prompt if they want to quit, this is not allowed on iOS?
While I can’t find a reference in the current iOS design docs and review docs, yes. There are plenty of examples of people who have been rejected for this. It’s a human decision on Apple’s end, so some people have gotten a quit button through, only to have another reviewer on an update reject it.
See:
https://ux.stackexchange.com/questions/7502/why-dont-mobile-apps-have-a-close-button/7518
https://forums.coronalabs.com/topic/42357-rejected-by-apple-because-the-game-has-a-exit-button/
It’s just not something that mobile apps need or mobile app users expect. Quitting a desktop app is a common practice, but mobile devices are really good about backgrounding the app so it’s not using very much memory or taking up CPU time while backgrounded.
Rob
What about the “winphone” platform? Can I have a quit button with them?
I have taken this into account and added the appropriate code, thank you.
I don’t know what Microsoft’s rules are, but it goes back to the point of one of the links above:
https://ux.stackexchange.com/questions/7502/why-dont-mobile-apps-have-a-close-button/7518
It’s just not something mobile apps have and WinPhone is still a mobile app.
Rob
Alright then. Welp, if there something I’ve learned from this:
No quit button.
How to view device platforms.
I’m not 100% sure about this, but I think you’re not supposed to force kill an app from within on iOS. i.e. For some reason I thought this was a design guidelines.
If not, however, os.exit() would still kill the app. I would simply do it AFTER warning the user and giving them an option not to exit.
Why do you need to forcibly exit?
As as SSK user you could do this:
-- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/system/ -- https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/misc/#easyalert local function doExit() if( oniOS ) then os.exit() else native.requestExit() end end ssk.misc.easyAlert( "Exit?", "Do you wish to exit?", {{"Yes", doExit}, {"No"}} )
I was not asking if I need to forcibly exit, just wanted to see what to do about iOS. Also, thank you for the snippet, I will try it out.
Your question implies you’re going to call an exit function.
This is forcibly exiting / killing the app.
Why do you need to do this?
I am asking because I am curious and I always like to know the root of a question so I can give the best possible answer.
Often times people ask the question they want solved and don’t present to reason they think that is the right question.
If folks presented the cause of their question earlier in the discussions, they would often get better help and better end results.
I’m saying this for future readers. Right now, I’m just curious.
Thanks, just tested this with Live Build, works great!
I did not intend for my question to sound like I was trying to quit forcibly. Sorry for the confusion. Just wanted to make sure my game encompasses functionality for both Android and iOS.
So you’re not calling either function and you were just curious about them?