Http://www.ithao123.cn/content-1363653.html
Apps that update data regularly, such as instant messaging, Weibo, and more
Settings, general-purpose, background application refresh.
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) Launchoptions method added:
[[UIApplication Sharedapplication] Setminimumbackgroundfetchinterval:uiapplicationbackgroundfetchintervalminimum ];
The Minimumbackgroundfetchinterval parameter value is two fetch interval and cannot be guaranteed to be called every time interval. This is set to Uiapplicationbackgroundfetchintervalminimum, which means calling our fetch method as frequently as possible.
Second, increase the implementation of the Fetch method
-(void) Application: (UIApplication *) application Performfetchwithcompletionhandler: (void (^) ( uibackgroundfetchresult)) completionhandler{};
This method is called every time the system fetch, we can do the refresh data in the method, and then call Completionhandlerblock () after the operation completes, for example: Completionhandler ( Uibackgroundfetchresultnewdata), the document says the system will estimate the power consumption of the fetch according to the Completionhandler (time of execution). If the time consuming consumes more, it may decrease the number of times it is called. However, this method is not a time-limited execution, saying that there is a 30s to perform the operation. The Completionhandler has three parameters:
Uibackgroundfetchresultnewdata successfully pulled data
Uibackgroundfetchresultnodata no new data
Uibackgroundfetchresultfailed Pull data failed or timed out
IOS Background Background Fetch