I am trying to do a URL request to an api and return the results.
I am using NSURLConnection in Swift 2
let requestString = "URL HERE"
let urlPath: String = requestString
let url: NSURL = NSURL(string: urlPath)!
let request: NSURLRequest = NSURLRequest(URL: url)
let connection: NSURLConnection = NSURLConnection(request: request, delegate: self, startImmediately: true)!
connection.start()
but I keep getting this warning:
'init(request:delegate:startImmediately:)' was deprecated in iOS 9.0: Use NSURLSession (see NSURLSession.h)
I googled the warning and came up with nothing....how do I fix this?