iphone - requires expression of scalar type?
I have this method on the delegate
- (BOOL) isBook:(int)number {
if ( ((number >= 0) && (number < 73)) ||
((number >= 432) && (number < 2864)) ) {
return YES;
}
return NO;
}
then I have this call on the class (yes the class has a delegate protocol declar开发者_如何学运维ed).
if ([delegate isBook:number]) {
//do stuff
}
I have an error on this IF saying: error: statement requires expression of scalar type ('void' invalid) ??????????
I have tried to do
if ([delegate isBook:numnber] == YES)
but it gives me another error: invalid operands to binary expression ('void' and 'int')
Why is that?
thanks
If your protocol is expressing that method as this:
- (void)isBook:(int)number;
Then that's most likely how you get the error; change it so it returns BOOL
like your implementation.
精彩评论