1 Reply
      Latest reply: Sep 8, 2016 7:10 AM by eskimo RSS
      Firenze Web Division Level 1 Level 1 (0 points)

        Please, I need a clarification regarding:

         

        App Programming Guide for iOS

        Background Execution

        Understanding When Your App Gets Launched into the Background

        Apps that support background execution may be relaunched by the system to handle incoming events. If an app is terminated for any reason other than the user force quitting it, the system launches the app when one of the following events happens:

        • For location apps:
          • The system receives a location update that meets the app’s configured criteria for delivery.

        ...

        In most cases, the system does not relaunch apps after they are force quit by the user. One exception is location apps, which in iOS 8 and later are relaunched after being force quit by the user. In other cases, though, the user must launch the app explicitly or reboot the device before the app can be launched automatically into the background by the system. When password protection is enabled on the device, the system does not launch an app in the background before the user first unlocks the device.

         

        How can I try ? How do I restart the app according to what I read ? Thanks a lot for availability

         

        Massimo Senatore

        Firenze Web Division

        Italy

        • Re: Please, I need a clarification regarding:  App Programming Guide for iOS Background Execution Understanding When Your App Gets Launched into the Background
          eskimo Apple Staff Apple Staff (6,055 points)

          How can I try ?

          You can exercise the ‘force quit’ case in the obvious way: by using the multitasking UI to force quit your app.

          You can exercise the ‘app was terminated by the system for other reasons’ case by calling exit while your app is in the background.  One approach I use runs something like this:

          1. when the app goes to the background, start a UIApplication background task (to prevent the app from being suspended) and a timer (for 30 seconds or so)

          2. when the timer fires, call exit to terminate your app

          3. trigger a location change and watch your app being relaunched

          WARNING Calling exit is fine for testing but don’t do it in your customer builds.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"