把这个放到*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;
}
最佳答案
有可能perror
就是nil
。谨防:
if (error && perror) {
*perror = error;
}