My iphone app background process terminates after 10 mins

后端 未结 3 965
栀梦
栀梦 2021-01-29 16:41

I have been facing a issue that my app doesnt run background for more than 10 mins , I have implemented background task which will fetch notifications instantly.

my appl

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-29 16:48

    If I'm not mistaken or not misunderstanding your question, this is expected behaviour. Background tasks are time limited so that one app doesn't run indefinitely and consume resources like battery power and cellular data.

    There are different types of background modes, some perform a set task and suspend when complete or timed out, others run periodically.

    You're likely looking to implement background fetch, wherein the OS will periodically wake your app and allow it to check for new content and perform a quick data fetch to get the latest data from your server.

    Background fetch can be triggered by a push notification that has the "content-available" flag set in its payload. The OS will be selective in scheduling background fetches for apps and will often coalesce them together to be more efficient. The OS will also learn when users run your app and try to schedule background fetches before the time a user opens your app so that the latest data is available.

提交回复
热议问题