POSSIBLE LEAD ON WHAT'S CAUSING THE ISSUE/POSSIBLE SOLUTION TO LOOK INTO
this has happened me just now too. There was no such error until the last ten minutes and I've been running the app all day with no queries that would cause this.
The errors give no indication of what's wrong, but when I removed the last thing I added before the issues arose it resolved. I had created a String extension as per below and then tried to use it. When I removed the extension the issues disappeared again.
Probably not the exact same thing for everyone, but if you have a similar extension changing an Apple type then it looks like certain methods that take time to go do something shouldn't be used because it would delay the main thread - in my case i was trying to check if a string could be opened as a url. I'm guessing here and don't fully understand but least the issues seem to disappear. Wish there was more info in the warning itself to help us identify why!
//MARK: - Extension to check if string is a valid url
extension String {
var isValidURL: Bool {
if let url = NSURL(string: self) {
return UIApplication.shared.canOpenURL(url as URL)
}
else if self.contains("https") == false && self.contains("www.") == true { //in case user didn't put https, check if added that
let newstring = "https://\(self)"
if let url = NSURL(string: newstring) {
return UIApplication.shared.canOpenURL(url as URL)
}
else {
return false
}
}
else {
return false
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: