Is there better way of 'requestMobileAuthorize' method call at once? I just want to solve this problem of logic that same function called multiple times in a function.
- nested function
- goto
if (needCheckExist) {
[self requestCheckExistPhone:_tmpMobile completion:^(NSDictionary *result, NSError *error) {
NSInteger statusCode = [[MLBizHandler commonHandler] statusCodeOfResultDataWithAlert:result];
if (statusCode == 1) {//if already exist
NSString *message = result[@"data"] && result[@"data"][@"message"] ? result[@"data"][@"message"] : nil;
if (message) {
[[JDFacade facade] alert:message];
}
} else {//not exist - but check refCode
_refCode = result[@"data"] && result[@"data"][@"ref_code"] ? result[@"data"][@"ref_code"] : nil;
[self requestMobileAuthorize:_tmpMobile completion:^(BOOL result) {
if (result) {
[self requestUpdatePhoneAndName];
}
}];
}
}];
} else {
[self requestMobileAuthorize:_tmpMobile completion:^(BOOL result) {
if (result) {
[self requestUpdatePhoneAndName];
}
}];
}
Aucun commentaire:
Enregistrer un commentaire