I am creating an NSURLSession on init of a class with the following code:
dispatch_once(&Static.token) { [unowned self] in
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(CONSTANTS.BackgroundSessionUploadIdentifier)
Static.session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: nil)
}
After it completes the class isn't being deinited and any future uploads' callbacks have the first class instantiation as their self. How do I properly cleanup an NSURLSession once my upload completes?
My entire class can be seen here: