1 Reply
      Latest reply on May 25, 2020 2:07 AM by eskimo
      XYZSSC Level 1 Level 1 (0 points)

        Hello,

                I need to make API Call every 1 min when the app is in the background state for the first 5 min, then make 2 calls for the next 5 mins. And finally, make 1 call in the last 5 min. I used the timer to fire service call accordingly but my app is been suspended after just 10-15 secs. But if I do another task like fire local notification or print logs then it works as expected in IO13, the thread is not being suspended in this case. Not sure why would OS allow to run this thread for an indefinite time but suspend any API call task.

        Can someone please explain if this is possible to achieve.

        • Re: API call when app is in Background in IOS13
          eskimo Apple Staff Apple Staff (13,905 points)

          I need to make API Call every 1 min when the app is in the background state for the first 5 min, then make 2 calls for the next 5 mins. And finally, make 1 call in the last 5 min.

          There’s no way to do this in a general-purpose app.  I’ve recently been discussing this on another thread, so I recommend that you read that and then post back here if you have follow-up questions.

          Share and Enjoy

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