I’ve tried to arrange this API name a number of alternative ways with many alternative tutorials and examples and maintain operating in to the identical error. The purple underline is all the time proper underneath the d in dataTask! Thanks upfront.
import UIKit
let url = URL(string: "https://blockchain.data/unspent?lively=(HomeViewController.currentUserAddresses.currentUsersBitcoinDepositAddress)")!
getUTXOs(from: url)
non-public func getUTXOs(from url: URL) {
let activity = URLSessionDataTask.shared.dataTask(with: url) { information, response, error in //ERROR: Kind of expression is ambiguous with out extra context
if let information = information {
//success
var consequence: UTXO?
do {
consequence = strive JSONDecoder().decode(UTXO.self, from: information)
}
catch {
print("Didn't decode: (error.localizedDescription)")
}
guard let json = consequence else {
return
}
print(url)
print(json.discover)
print(json.outcomes?.worth)
print(json.outcomes?.tx_hash)
} else if let error = error {
print("HTTP Request Failed (error)")
}
}
activity.resume()
}
`
I’ve adopted iOS Academy’s video rigorously AND this, https://cocoacasts.com/networking-fundamentals-how-to-make-an-http-request-in-swift nicely written tutorial each of which giving the identical error!