1

Coming from Android development where we have background services that run nicely its a little hard for me to start thinking the Apple way. What we achieved in Android was that our background service keeps updating our database at regular interval which can than update the UI if they are in foreground or when they user start the app.

Things look a little different in iOS as there is nothing similar to Background Services. Here are my question

  • Is there ANY way that my background fetch run even if my app is terminated by user? I am not using HTTP to download content so I am not sure if Background Transfer Service API would help.
  • Is there a possibility to schedule multiple fetch operations at varying times?

Or do I have to completely rethink how my services work for iOS development? Any idea would be appreciated.

ata
  • 8,403
  • 6
  • 36
  • 63

1 Answers1

2

If you google "background fetch iOS", you'll see tons of links. Bottom line, effective iOS 7, Apple introduced background fetch (see the Fetching Small Amounts of Content Opportunistically section of the App Programming Guide for iOS: Background Execution). This is designed for an app to be able to periodically check to see if there is more data to download.

iOS 7 also introduced NSURLSession and background NSURLSessionConfiguration, which allows you to initiate a series of requests that will continue even after the app is terminated.

For general counsel on background operations, see the aforementioned App Programming Guide.

Rob
  • 371,891
  • 67
  • 713
  • 902
  • Thanks for links, but I have already read through them. One thing I dont understand is how gmail and other such app get updates even though I have terminated them from app switcher? – ata Dec 04 '14 at 09:44
  • Could be either background fetch, referenced in that doc (where it periodically checks for updates) or some push notification mechanism. – Rob Dec 04 '14 at 11:34