I need to do a simple NSURLConnection when application goes in background or when ends.
How can I do this ?
I dont' need to download anything or to do any long time operations, I only need to call an API from web service.
Asked
Active
Viewed 41 times
0

enfix
- 6,680
- 12
- 55
- 80
2 Answers
1
In your applicationWillResignActive use -[UIApplication beginBackgroundTaskWithExpirationHandler:] to start up a background network operation. Be sure to call endBackgroundTask when you're done. The major caution here is that you only have a short amount of time (10 seconds iirc) to finish up.

David Berry
- 40,941
- 12
- 84
- 95