6

I'm currently working on an app that should periodically (every minute) perform a network call while the app is backgrounded or killed. This network call will send information to our API.

Is this possible on iOS? How?

jscs
  • 63,694
  • 13
  • 151
  • 195
Steven B.
  • 1,429
  • 2
  • 19
  • 38
  • If the app is killed how can it "perform" anything? – matt Feb 10 '16 at 14:43
  • @matt Background Execution – brimstone Feb 10 '16 at 15:12
  • If it is killed it is not in the background @GabrielJones – matt Feb 10 '16 at 15:21
  • An app can check for updates even if it has been closed @matt – brimstone Feb 10 '16 at 15:22
  • He didn't say check for updates, and no it can't. The system does the work on your behalf, and not every minute either. Read the question! The premise is preposterous. We do the OP no service by pretending otherwise. @GabrielJones – matt Feb 10 '16 at 15:24
  • @matt Sorry, I thought the background checks apps do happened even when the app was closed, my bad – brimstone Feb 11 '16 at 12:54
  • Possible duplicate of [iOS application executing tasks in background](http://stackoverflow.com/questions/5323634/ios-application-executing-tasks-in-background) – brimstone Jun 02 '16 at 19:44

1 Answers1

2

Assuming you want a service like a Social Media app, where it will check in the background every minute for new activity, you should use background execution.

Have a look at this Background Execution tutorial and the Apple Reference for Background Execution.

brimstone
  • 3,370
  • 3
  • 28
  • 49
  • Where in the first link above (this Background Execution tutorial), it has been mentioned that the iOS application can perform a repeating network request after a delay of some n seconds ? Even if one use a delayed option like dispatch_after or sleep(n) still then I don't think the network calls will go on repeating when app is in background – user2788672 Dec 09 '16 at 13:05