Cannot call value of non-function type \'NSHTTPURLResponse?\'
Can someone please help me here?
Here is the code
public func responseObjec
You need to mark your completionHandler as @escaping.
Had this error myself and took a while to figure out why it was occurring. It looks like if the parameters to the response()
method call don't match to any method declarations then swift assumes your code is referring to the response
property, a NSHTTPURLResponse
. Because there the property that "shadows" the method's name, swift can't help you out with errors that indicate which parameter is a problem, it just punts on matching to any method.
In my case, completionHandler
was mismatched because of its parameters. Note, its the sample code I saw .response { response in ... }
that's problematic. There's no response
method taking a "response in" closure like there is for the responseString
, responseJSON
, etc. methods.
That said, Abh, I can't tell from looking what the exact issue is with your code.