【发布时间】:2012-03-11 16:33:48
【问题描述】:
- (BOOL)parserJSONString:(NSString *)jsonString error:(NSError **)anError {
//some data getting
//error handle
NSString *description = @"phone number couldn't be using";
NSString *recoverySuggestion = @"Please provide an other phone number.";
NSInteger errorCode = -1;
NSArray *keys = [NSArray arrayWithObjects: NSLocalizedDescriptionKey, NSLocalizedRecoverySuggestionErrorKey, nil];
NSArray *values = [NSArray arrayWithObjects:description, recoverySuggestion, nil];
NSDictionary *userDict = [NSDictionary dictionaryWithObjects:values forKeys:keys];
*anError = [[NSError alloc] initWithDomain:@"my domain" code:errorCode userInfo:userDict];
return NO;
}
*anError = [[NSError alloc] initWithDomain:@"my domain" code:errorCode userInfo:userDict]; 编译器给出下一个泄漏警告
“潜在的空值取消引用。根据‘创建和返回 NSError 对象’中的编码标准,参数‘’可能为空”
如何解决这个问题?
【问题讨论】:
标签: iphone objective-c ios ipad automatic-ref-counting