自定义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];