07-18-2023, 08:59 PM
> Warning:'sendSynchronousRequest(_:returningResponse:)' was deprecated
> in iOS 9.0: Use [NSURLSession dataTaskWithRequest:completionHandler:]
> (see NSURLSession)
urlData = try NSURLConnection.sendSynchronousRequest(request, returningResponse:&response)
Any idea on how to get rid of this warning? I just upgraded from Swift 1.2 to Swift 2
UPDATE: Fonix is marked as my best answer. If your trying to add a try statement, I modified his answer as followed:
urlData = try NSURLSession.dataTaskWithRequest(<#request: NSURLRequest#>, completionHandler: <#((NSData!, NSURLResponse!, NSError!) -> Void)?##(NSData!, NSURLResponse!, NSError!) -> Void#>)
> in iOS 9.0: Use [NSURLSession dataTaskWithRequest:completionHandler:]
> (see NSURLSession)
urlData = try NSURLConnection.sendSynchronousRequest(request, returningResponse:&response)
Any idea on how to get rid of this warning? I just upgraded from Swift 1.2 to Swift 2
UPDATE: Fonix is marked as my best answer. If your trying to add a try statement, I modified his answer as followed:
urlData = try NSURLSession.dataTaskWithRequest(<#request: NSURLRequest#>, completionHandler: <#((NSData!, NSURLResponse!, NSError!) -> Void)?##(NSData!, NSURLResponse!, NSError!) -> Void#>)