Reputation: 14875
I'm again confronted with a strange error in Swift.
Cannot convert the expression's type 'NSData!' to type 'NSURLRequest!'
My code is:
var request = NSURLRequest(URL: url, cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalCacheData, timeoutInterval: 5)
var response : NSURLResponse?
var error : NSError?
NSURLConnection.sendSynchronousRequest(request, returningResponse: response, error: error)
//The error is reported at the above line
What does that mean? I nowhere try to convert NSData to NSURLRequest.
Upvotes: 1
Views: 2388
Reputation: 130102
I am not sure why such a message is displayed but you are missing the &
for inout
parameters.
NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: &error)
Upvotes: 4