IOS Background Background Fetch

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.