问题
I have a question about AFNetworking 2 and background downloads/uploads thanks to the new iOS7 NSURLSession background requests
Is this automatically handled by my AFHTTPRequestOperationManager
? Does it automatically set my requests'session to background mode?
I saw that the AFURLSessionManager
Has a setDidFinishEventsForBackgroundURLSessionBlock
Method but I wonder if everything is automatic?
If my app is killed or suspended, will requests keep on going? How can I get a callback when my app is relaunched?
Thanks a lot for your help!
回答1:
AFHTTPRequestOperationManager
uses the old NSURLConnection
so that doesn't facilitate background downloading.
AFURLSessionManager
uses NSURLSession
under the hood so that does. I think you still need to configure the NSURLSession
appropriately.
"The NSURLSession class supports background transfers while your app is suspended. Background transfers are provided only by sessions created using a background session configuration object (as returned by a call to backgroundSessionConfiguration:)."
Suggested reading:URL Loading System
来源:https://stackoverflow.com/questions/21476669/afnetworking-2-and-background-tasks