自定义NSError

domain:错误域 
code:错误编码
userInfo:错误缘由

NSString *domain = @"xxxxxx";
NSString *desc = NSLocalizedString(@"xxx", @"xxx");//NSLocalizedString国际化
NSDictionary *userInfo = @{NSLocalizedDescriptionKey : desc };

NSError *error = [NSError errorWithDomain:domain code:-101 userInfo:userInfo];
相关文章
相关标签/搜索