2

I use AFAmazonS3 (which is an extention of AFNetworking)

It has AFHTTPRequestOperation that is created and added to the operation queue [self.operationQueue addOperation:requestOperation];

The thing is that when the app goes to background it stops uploading and doesn't resume when it goes back.

How can I acheive it? I saw some solutions but it was for the old version of AFNetworking

Boaz
  • 4,864
  • 12
  • 50
  • 90
  • Two options: 1. If you just need a few minutes to finish a request even though the user has left the app, point 3 in http://stackoverflow.com/questions/21350125/afnetworking-2-0-and-background-transfers/21359684 shows an approach that is compatible with `AFHTTPRequestOperation`. 2. If you want proper background sessions (`NSURLSession` based), you have to abandon `AFHTTPRequestOperation` in favor of `AFHTTPSessionManager`. I walk through some of the issues on using `AFHTTPSessionManager` for background requests in that same answer. – Rob Apr 22 '15 at 21:08

1 Answers1

1

AFNetworking supports Background operations.This post is mentioning setShouldExecuteAsBackgroundTaskWithExpirationHandler: and explaining how to use it https://stackoverflow.com/a/7881866/3033056 . This method is in AFURLConnectionOperation and AFHTTPRequestOperation inherits from AFURLConnectionOperation

Community
  • 1
  • 1
Mohamed Elkassas
  • 829
  • 1
  • 13
  • 33