简体   繁体   中英

iPhone - How to perform task in background?

I want to call a method in a regular time interval when the app is running in the background(minimize).

like i want to call web service daily....and want to show the result of this webService in the localNotification message body. How to do this Task ?

Please follow this guide, provided from Apple, to see how applications enter the background:

http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

Look for the section called Background Execution and Multitasking :

However, you can only run specific kind of tasks in the background:

  • Apps that play audible content to the user while in the background, such as a music player app
  • Apps that keep users informed of their location at all times, such as a navigation app
  • Apps that support Voice over Internet Protocol (VoIP) Newsstand apps that need to download and process new content
  • Apps that receive regular updates from external accessories

If your application falls within the grasp of these types, you can now proceed to determine the application type.

The possible types are:

  • audio —The app plays audible content to the user while in the background. (This content includes streaming audio or video content using AirPlay.)
  • location —The app keeps users informed of their location, even while it is running in the background.
  • voip —The app provides the ability for the user to make phone calls using an Internet connection.
  • newsstand-content —The app is a Newsstand app that downloads and processes magazine or newspaper content in the background.
  • external-accessory —The app works with a hardware accessory that needs to deliver updates on a regular schedule through the External Accessory framework.
  • bluetooth-central —The app works with a Bluetooth accessory that needs to deliver updates on a regular schedule through the CoreBluetooth framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM