+2 votes

I have 2 questions related to quitting the game on devices with iOS.

  1. How to quit game on iOS?
    get_tree().quit() doesn't work for me.

  2. How to get iPhone's home button press notification?

in Engine by (675 points)
edited by

2 Answers

0 votes

1: It is against Apple's rule to display quit and close request on iOS. Here is citation from Apple developer's instruction:

People stop using an app when they switch to another app, return to the Home screen, or put their devices in sleep mode.

2: Using this for other purposes than send signal to save data can be again considered as going against Apple's conventions because it overrides function of iPhone's home button.

by (675 points)
edited by
0 votes

How to get iPhone's home button press notification?

func _notification(what):
    if what == MainLoop.NOTIFICATION_WM_FOCUS_IN:
        print("NOTIFICATION_WM_FOCUS_IN")
    elif what == MainLoop.NOTIFICATION_WM_FOCUS_OUT:
        print("NOTIFICATION_WM_FOCUS_OUT")
by (9,742 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.