Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension NSError {
- var serializedErrorData: [String : AnyObject]? {
- get {
- if let responseData = userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] as? NSData {
- if let data = try? NSJSONSerialization.JSONObjectWithData(responseData, options: NSJSONReadingOptions.AllowFragments) as? [String : AnyObject] {
- return data
- }
- }
- return nil
- }
- }
- var serializedErrorCode: Int? {
- get {
- if let errorCode = serializedErrorData?["error_code"] as? Int {
- return errorCode
- }
- return nil
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement