ios - Why do I get ambiguous reference to member error? -


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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -