在*perror = error
行上进行此操作。即使我将其包裹在if (error)
- (BOOL)validate:(NSError **)perror password:(BOOL)password {
BOOL ret = YES;
NSMutableString * errorMessage = [@"" mutableCopy];
...other validation code
NSError * error = [NSError errorWithDomain:@"Profile" code:100 userInfo:dictionary];
if (error) {
*perror = error;
}
return ret;
}
答案 0 :(得分:3)
perror
可能是nil
。警惕:
if (error && perror) {
*perror = error;
}