自定义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];
原文地址:https://www.cnblogs.com/lulushen/p/10689677.html