xcode 8 value of type 'Error' has no member 'userinfo' xcode 8 value of type 'Error' has no member 'userinfo' ios ios

xcode 8 value of type 'Error' has no member 'userinfo'


First of all, post the code (text) rather than a screenshot.

In Swift 3 NSError has been replaced in many APIs with more generic Swift Error protocol which has no userInfo dictionary. Bridge cast the object to NSError

if let errorString = (error as? NSError)?.userInfo....


I found this worked

let errorUserInfo : NSDictionary? = ((error as Any) as! NSError).userInfo["error"] as? NSDictionary