ios - Why do I get ambiguous reference to member error? -
this question has answer here:
using following code
if let url = nsurl(string: "https://upload.wikimedia.org/wikipedia/en/thumb/7/7d/full_sail_university.svg/1280px-full_sail_university.svg.png") { let task = session.datatask(with: url, completionhandler: { (data, response, error) in // check against error if let error = error { print("data task failed error: \(error)") return } print("success") }) task.resume() }
i following error:
ambiguous reference member 'datatask(with:completionhandler:)'
why , how can fix this?
error in nsurl
. change the
if let url = nsurl(string: "https://upload.wikimedia.org/wikipedia/en/thumb/7/7d/full_sail_university.svg/1280px-full_sail_university.svg.png") {
to
if let url = url(string: "https://upload.wikimedia.org/wikipedia/en/thumb/7/7d/full_sail_university.svg/1280px-full_sail_university.svg.png") {
Comments
Post a Comment