so having some issues with creating a URLSession
in Swift 3 referencing the dataTask
. I am getting this error and do not understand why:
Ambiguous reference to member 'dataTask(with:completionHandler:)'
func fetchVideos() {
let url = NSURL(string: "https://s3-us-west-2.amazonaws.com/youtubeassets/home.json")
URLSession.shared.dataTask(with: url!) { (data, response, error) in
if error != nil {
print(error)
return
}
let str = NSString(data: data!, encoding: NSUTF8StringEncoding)
print(str)
// this resume function is not reading correctly either
}.resume()
}