I'm trying to cancel an asynchronous request if there is a problem with the internet connection.
var connection: NSURLConnection!
self.connection = NSURLConnection.sendAsynchronousRequest(request2, queue: NSOperationQueue.mainQueue())
{
(response, data, error) in ();
if(response != nil){
if let Data: AnyObject! ..... }
This is the code. I'm trying to cancel the request by:
self.connection.cancel()
but I have some errors : Cannot assing a value of type 'void' to a value of type NSURLConnection.