NSURLSession -- background session

IMPORTANT You can’t use NSURLSession’s convenience APIs, things like -uploadTaskWithRequest:fromFile:completionHandler:, in a background session.  You must use the delegate-based API, for example, -uploadTaskWithRequest:fromFile:.  This makes sense when you think about it; if your app is terminated and then relaunched, there’s no way for the system to reconstitute the state held in a completion handler block.


Refer: https://forums.developer.apple.com/message/27555#27555

你可能感兴趣的:(iphone开发)