I just downloaded iOS 13 for my iPhone and the new Xcode. I wanted to test my app for iOS 13, but when I try to run my app it will give me a error after a few seconds. Error
You should wrap handling error by DispatchQueue.main.async{}
func Download_ID() {
let urlString = "https://www.instagram.com/\(self.username_String)/?__a=1"
guard let url = URL(string: urlString) else { return }
URLSession.shared.dataTask(with: url) { data, urlResponse, error in
guard let data = data, error == nil, urlResponse != nil else {
// Add DispatchQueue
DispatchQueue.main.async {
print(error)
}
return
}
do
{
let decoder = JSONDecoder()
let downloadedData_user = try decoder.decode(Website.self, from: data)
// your logic
DispatchQueue.main.async {
// update or reload table in here
}
} catch {
// Add dispach_queue
DispatchQueue.main.async {
print(error)
}
}
}.resume()
}