I'm creating a method that checks if the user has any friends who are already registered to the app. However, when I'm trying to return from within this block, i get a compiler error saying: Incompatible block pointer types sending 'BOOL (^)(__strong id, NSError *__strong)' to parameter of type 'PFIdResultBlock' (aka 'void (^)(__strong id, NSError *__strong)')
This is when I run the code below:
-(BOOL)hasFriend:(NSArray*)phoneNums{
[PFCloud callFunctionInBackground:@"checkUsers"
withParameters:@{@"array": phoneNums}
block:^(id success, NSError *error) {
if(success){
return YES;
}
else{
return NO;
}];
}
I've also tried this:
-(BOOL)hasFriend:(NSArray*)phoneNums{
__block bool hasFriend = nil;
[PFCloud callFunctionInBackground:@"checkUsers"
withParameters:@{@"array": phoneNums}
block:^(id success, NSError *error) {
if(success){
hasFriend = YES;
NSLog(@"found a florin user!");
}
else{
hasFriend = NO;
}
}
}];
NSParameterAssert(hasFriend);
return hasFriend;
}
However, this never passes the NSParameterAssert
.