iOS background application network access

I have an application that requires location tracking and I think it fits squarely within one of the allowable background models. However, I need to post to a network service when there are significant changes of location. I've seen write-ups that state network access is prohibited in background processing, but I didn't read that in Apple's docs.

Does anyone know if it's kosher (wrt Apple policies) to make occasional and very quick network updates in a background process?


Solution 1:

Good point, according to the Apple documentation only the following usages are allowed in background and each service should be registered:

  • 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.

Other than this services, you can create a Finite-Length Task in the Background that actually give you the possibility to end a network process.

This can be important if your app is performing some important task, such as writing user data to disk or downloading an important file from a network server.

Regarding your question, it's not really clear if you can or not can do a quick network connection if you've a location service running in background. I would say YES for a short connection, but not totally sure. Since iOS 4.0 this usage was denied and clear in documentation, now that part has been removed.

Solution 2:

Yes if you use background for just quick connection. Apple won't allow you to run in the background as you want.

NO If your app does not fall in the Voip, music or GPS category; then you can't run in background.

more here: Update my app when it is in background


You could use ASIHTTPRequest.

ASIHTTPRequest has a property setShouldContinueWhenAppEntersBackground:. default is NO, you may turn on YES so you have background network process.

Solution 3:

Apple documentation seems a bit unclear on the strict policy. There are definitely applications in the app store that make sporadic network calls while running in the background as a location-based application. An example is the Geoloqi application.