var request:NSMutableURLRequest = NSMutableURLRequest(URL:URL)
var sessionConf: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration()
var session: NSURLSession = NSURLSession(configuration: sessionConf)
let postData = session.dataTaskWithRequest(request, completionHandler: {(data, response, error) in
//... there some code to work with Core Data
self.navigationController.popViewControllerAnimated(true) // <- This work slow
})
If I'll replace println("test")
instead popViewControllerAnimated
just for test code work with Core Data - it's work in one moment and I see "test" in logs. But with popViewControllerAnimated
after call entire app freeze for about of 20-30 sec. I thought it is because NSURLSessionDataTask
has timeout interval for request and response data. So I've tried: make sessionConfi.timeoutIntervalForResource
and sessionConfi.timeoutIntervalForRequest
for 3.0
but it doesn't help.
I found this NSURLSessionDataTask acting suspiciously slow
But I can't add dispatch_async(dispatch_get_main_queue())
because UIViewController is not a subtype of Void
. Where I should define a type?