Dear meaton,
Thank you so much for your comment!!
(And I am so sorry for my previous wrong comment)
Now, I am making an application to visualize some vital data from a smart ring.
Then, to get data, I tried URLSession like:
func startLoad() {
let url = URL(string: "https://www.abcde-test-url.com/")!
let task = URLSession.shared.dataTask(with: url) { data, response, error in
if let error = error {
print("client error: \(error.localizedDescription)")
return
}
guard let data = data, let response = response as? HTTPURLResponse else {
print("no data or no response")
return
}
if response.statusCode == 200 {
print(data)
} else {
print("error status code: \(response.statusCode)")
}
}
task.resume()
}
But, when I get the data from the smart ring server, I have to log in the smart-ring maker's website firstly. Therefore, I would like to use URLCredential for automatic log-in.
So I read the article but I couldn't understand the usage with URLCredential.
In the official article, an description as "Implement the delegate methods described..." is written. However, I don't know the way how should I use the delegate method to use URLCredential.
I am so sorry for my poor skill...