I'm coming across a behavior that is nowhere noted in apple's documentation. I'm making a call over the network using NSURLSession
with a NSURLSessionConfiguration.defaultSessionConfiguration()
object. According to apple's docs, this is supposed to be only used when it's in the foreground, but makes absolutely no mention of using it while the app is in the background. This is really quite baffling, I've even setup a delegate to deal with the incoming location updates while it's in the background. I'm really not interested in using NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(_:)
because I can only do an upload or download from a file when i'm looking to send the user's latitude and longitude to the back-end. Here's how I did it:
// Configuration for session object
let sessionConfigObject = NSURLSessionConfiguration.defaultSessionConfiguration()
// Initialize session object with its configuration
let session = NSURLSession(configuration: sessionConfigObject, delegate: self, delegateQueue: nil)
Can someone explain this to me and why this is allowed?