I created an HTTPServiceProvider class inherited from AFURLSessionManager. Added code below to receive data.
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() let manager = AFURLSessionManager(sessionConfiguration: configuration) let dataTask = manager.dataTaskWithRequest(request) { (response, responseObject, error) in
I want to add a dataTask to the operationQueue provided by AFURLSesstionManger and cancel all operations in some other class (BaseController.swift) before invoking the same request again.
Tried this code but didn't work -
self.operationQueue.addOperationWithBlock{
And inside the BaseController.swift file called -
HTTPServiceProvide.sharedInstance.operationQueue.cancelAllOperations
But its not working :(
Thanks.
source share