我正在为我的应用程序创建一个验证方法,悬停我的返回值有问题;
不兼容的块指针类型发送字符...
-(BOOL)validateEmail{
if (self.ownUser.emailUser != self.emailField) {
[UserAPIClient validateEmail:self.emailField sucess:^(BOOL sucess, NSError *error) {
if (sucess) {
return YES;
}else{
NSLog(@"Can´t change e mail, already one is created in the database");
return NO;
}
}];
}else{
return YES;
}
}
有人可以帮我解决这个问题吗?
提前致谢...
编辑
我完全错过了正确的解决方案,只需采用我的UserApiClient返回一个 BOOL
-(BOOL)validateEmail{
if (self.ownUser.emailUser != self.emailField) {
return [UserAPIClient validateEmail:self.emailField];
}else{
return YES;
}
}
编辑 2 知道,我刚刚意识到,我需要这种方法的结果来进行一些更改。如何将此方法更改为同步方法?
[[MYApiClient sharedInstance] getPath:@"validateEmail" parameters:params
success:^(AFHTTPRequestOperation *operation, id JSON) {
NSLog(@"SUCESS %@", JSON);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error %@", error);
}];