我已经解决了一些 Stack Overflow 问题,但我似乎不知道如何调整我的代码以包含故障块。如何向此代码添加故障块?
+ (void)loginUser:(NSString *)username withPassword:(NSString *)password :(void (^)(BOOL finished))completionBlock {
NSString *endpoint = @"Users/Login";
[self postEndpoint:endpoint params:[NSMutableDictionary dictionaryWithObjectsAndKeys:username, @"Username", password, @"Password", nil] completionBlock:^(DollarResponse *response) {
NSLog(@"%@",response);
if ([response.result isEqual:[NSNull null]]) {
[self displayError:response.message];
} else {
Login *login = [[Login alloc] initWithDictionary:response.result];
[self saveLogin:login];
completionBlock(YES);
}
}];
/* loginUser:withPassword:: */