urlSession( .. didReceive reponse ...) not called

Currently on Xcode8 beta 6.

func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler:
 (URLSession.ResponseDisposition) -> Void) {
     // NOT CALLED

}

I'm trying to use this method, it occurs a warning:

Instance method 'urlSession(_:dataTask:didRecieve:completionHandler:)' nearly matches optional requirement 'urlSession(_:dataTask:didReceive:completionHandler:)'
of protocol 'URLSessionDataDelegate'

Fix-it Make 'urlSession(_dataTask:didReceive:completionHandler:)' private to silence this warning
Fix-it Add '@nonobjc' to silence this warning


However, no matter which method I use to fix the warning, this function seems not working.

I think you have to mark your completion handler as @escaping:


func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
urlSession( .. didReceive reponse ...) not called
 
 
Q