Running URL Requests in the Background

前端 未结 3 1306
面向向阳花
面向向阳花 2021-01-28 07:02

I want to make url request in a certain time interval (e.g. every 10 minutes app should make a url call and get some json data). App should be able to do this when running in ba

3条回答
  •  时光取名叫无心
    2021-01-28 07:50

    At the basic level : simply schedule a NSTimer and launch the URL request on the timer function. If you are targeting iOS7 then make sure you are using NSURLSession. However an important point is to know if you want to do tis in the background or not. If yes you have to find out more about the iOS background modes as you will not be able to maintain your timer in this mode.. Nothing there should cause rejection.

提交回复
热议问题