iOS Run Code Once a Day

后端 未结 5 924
北海茫月
北海茫月 2020-11-27 03:44

The idea behind this app is very simple: download a file. However this app will be for people who are not always within internet access range, so I need it to know that at,

5条回答
  •  一向
    一向 (楼主)
    2020-11-27 04:05

    Background applications have a set time limit (I believe 10 minutes, but don't quote me on that, it could be less) to complete whatever they are working on. You will not be able to use background tasks to do what you want.

    What you can do is set an NSUserDefault with the date of the last download. On launch check the date saved, if the date is not the current date, and it is after 9:00am, initiate the download programatically.

提交回复
热议问题