NSError

前言

整理一下在iOS开发中NSError的错误代码

NSError

NSError是系统错误信息类

初始化方法两个

属性

@property (readonly) NSInteger code;//错误代码

@property (readonly, copy) NSDictionary *userInfo;//错误信息

@property (readonly, copy) NSString *localizedDescription;//获取本地化描述

@property (nullable, readonly, copy) NSString *localizedFailureReason;//获取失败原因

@property (nullable, readonly, copy) NSString *localizedRecoverySuggestion;//获取恢复建议

@property (nullable, readonly, copy) NSArray<NSString *> *localizedRecoveryOptions;本地恢复建议

@property (nullable, readonly, strong) id recoveryAttempter;

@property (nullable, readonly, copy) NSString *helpAnchor;

NSError错误code对照表

有关网络请求失败的解释

文章来源:

Author:Oragekk's Blog
link:https://oragekk.me/posts/iOS/system/NSError.html