Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Question about native.requestExit
Started by sdktester15 Jun 29 2018 08:18 AM

13 replies to this topic

Best Answer Rob Miracle , 29 June 2018 - 12:50 PM

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://stackoverflow.com/questions/8739178/does-apple-disallow-the-use-of-a-close-button-on-ios-ipad

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

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

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?



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,748 posts
  • Corona SDK

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"}} )


[TOPIC: post.html]
#3

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,748 posts
  • Corona SDK

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.


Edited by roaminggamer, 29 June 2018 - 08:46 AM.


[TOPIC: post.html]
#5

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

Thanks, just tested this with Live Build, works great!



[TOPIC: post.html]
#6

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,748 posts
  • Corona SDK

So you're not calling either function and you were just curious about them?



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,119 posts
  • Corona Staff

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



[TOPIC: post.html]
#9

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

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?



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,119 posts
  • Corona Staff

  Best Answer

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://stackoverflow.com/questions/8739178/does-apple-disallow-the-use-of-a-close-button-on-ios-ipad

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



[TOPIC: post.html]
#11

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

What about the "winphone" platform? Can I have a quit button with them?



[TOPIC: post.html]
#12

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

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://stackoverflow.com/questions/8739178/does-apple-disallow-the-use-of-a-close-button-on-ios-ipad

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

I have taken this into account and added the appropriate code, thank you.



[TOPIC: post.html]
#13

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,119 posts
  • Corona Staff

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



[TOPIC: post.html]
#14

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,142 posts
  • Corona SDK

Alright then. Welp, if there something I've learned from this:

 

No quit button.

How to view device platforms.




[topic_controls]
[/topic_controls]