iOS background process similar to Android AlarmManager

前端 未结 5 1840
再見小時候
再見小時候 2021-02-20 10:51

I\'ve to schedule a fixed task that check some info from internet at fixed interval timer.

Into Android, I use AlarmManager with setRepeating, but I\'m newbie to iOS. Th

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 11:14

    Check link on Apple's Multitasking Guide that add's the voip tag to UIBackgroundModes in Info.plist and use setKeepAliveTimeout:handler: method of UIApplication to relaunch it if needed once the app is going to sleep.

    Note : For this you need to take special permissions from Apple and mostly Apple rejects such app.

    Another solution :-

    You can store last sync date and if sync date has crossed your interval when application comes from background, you can start sync your data.

    Hope this info helps you..

提交回复
热议问题