How make iOS app running on background Every one minute in Swift?

前端 未结 3 1393
[愿得一人]
[愿得一人] 2021-01-29 10:01

I want to make an app that makes HTTP request to a website periodically. The app has to run in the background, but can wake up or show a notification, depending on a response of

3条回答
  •  醉梦人生
    2021-01-29 10:36

    If you use silent push notification, you should know that silent push have some limit for frequency send.

    https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns

    Check to see if silent notifications are being throttled. APNs sends a limited number of silent notifications—notifications with the content-available key—per day. In addition, if the device has already exceeded its power budget for the day, silent notifications are not sent again until the power budget resets, which happens once a day. These limits are disabled when testing your app from Xcode.

    And don't get to application if application force-quit.

    If you need guaranteed delivery, you should use VoIP push notification. But you need reason for Apple, why you need VoIP push.

    But you're way drain battery non stop, and it not friendly for you're users.

提交回复
热议问题