Background sync in iOS7

2019-04-30 20:27发布

问题:

We have to develop an app which will support data sync operations at some time interval, whether the app is in foreground or in background.

I want to know that in iOS7…

  • is it possible to sync data (i.e. call web services) while the app is in background?
  • can we access SQLite data base file/can we do DB operations while the app is in background?
  • can we run timers in background?
  • can we show alerts about some updates while the app is in background?

Thanks in advance.

回答1:

  1. Yes, it is.
  2. Yes, you can.
  3. Sometimes, but you shouldn't.
  4. Yes, you can.

Go and research iOS 7 background operations. Talk of using timers and background operations at some time interval indicate you're approaching the problem in a way that won't work. While the answer to most of your questions is yes, your approach is probably no...

Start with application:performFetchWithCompletionHandler:.