Posts

Post not yet marked as solved
0 Replies
908 Views
Hi,I would like to display the CKError encountered to the user in the app as an alert.I tried to use localizedDescription but it doesn't seem to contain an appropriate stringGiven below is the example:po error <CKError 0x1c464cea0: "Network Unavailable" (3/NSURLErrorDomain:-1009); "The Internet connection appears to be offline."> po error.localizedDescription "The operation couldn’t be completed. (CKErrorDomain error 3.)" po (error as! CKError).errorUserInfo ▿ 2 elements ▿ 0 : 2 elements - key : "NSUnderlyingError" - value : Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={NSErrorFailingURLStringKey=https:/ ▿ 1 : 2 elements - key : "NSDebugDescription" - value : NSURLErrorDomain: -1009 po (error as? NSError)?.localizedFailureReason nil po (error as? NSError)?.localizedRecoverySuggestion nil po (error as? NSError)?.localizedRecoveryOptions nilpo (error as? NSError)?.debugDescription ▿ Optional<String> - some : "<CKError 0x1c064eaf0: \"Network Unavailable\" (3/NSURLErrorDomain:-1009); \"The Internet connection appears to be offline.\">"Questions:The debug description seems to be the closest to what I want.1. Am I missing something ?2. What is the correct way to extract the error string that I can display to the user ?
Posted
by newwbee.
Last updated
.