Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

On Suspend iOS Outdated Documentation?

Discussion in 'iOS and tvOS' started by bbro5628, Jan 11, 2021.

  1. bbro5628

    bbro5628

    Joined:
    Dec 25, 2020
    Posts:
    10
    Hello I am trying to follow the documentation onApplicationQuit. For iOS it says ". For iOS builds, enable the "Exit on Suspend" property in Player Settings" when I was looking on other forums I found this image from a user showing the setting. When looking through my player setting I cannot find this setting in my player preferences after looking at more documentation is the setting different?

    Images:
    Found on a previous forum (2015):

    My Current Project Settings (Unity 2019.4.17f1 in 2020)
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    "Exit on Suspend" was deprecated by apple, so it is either suspend or "custom" background mode
    we have also changed the way we handle background modes, now there is a special enum
    https://docs.unity3d.com/ScriptReference/iOSBackgroundMode.html
    also it was moved in player settings.
    I will see into updating the docs
    Screenshot 2021-01-11 at 19.07.38.png
     
  3. bbro5628

    bbro5628

    Joined:
    Dec 25, 2020
    Posts:
    10
  4. larami100

    larami100

    Joined:
    Feb 11, 2021
    Posts:
    2
    Hi bbro5628. Could you make this work?

    I'm trying to track when the game is closed. OnApplicationQuit is called if I try with Unity Editor but that doesn't happen with the iOS release. I only checked "Enable Custom Background behaviors". Do I have to check another option? Or what else must I do?

    Thanks!
     
    jzIsSumBuddy and kirbycravens like this.
  5. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    250
    @Alexey I have a question, you said "it is either suspend or "custom" background mode", so how the OnApplicationPause() method is working currently? Please let me know.
     
  6. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    You can check the implementation of
    Code (csharp):
    1. - (void)applicationWillResignActive:(UIApplication*)application
    in UnityAppController.mm

    in short: we check the background processing, if it is suspend, we run one more player loop (so your scripts actually get OnApplicationPause message) and then suspend; and if there is some background mode, you are not paused "technically", so we pretend nothing have happened (note, you will get "focus lost" in both cases)
     
    Neonlyte and Sailendu like this.
  7. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    The documentation does not look like it was updated since it still shows the "Exit On Suspend"
     
    sinketita and ivoras like this.