I declared a function with boolean input var. I get no errors. However, when calling it from another controller, notification appears: "incompatible integer to pointer conversion sending'BOOL' to parameter of type BOOL". What am I doing wrong? Thanks.
- (void)composeBar: (BOOL *)savePars
from other view:
AppDelegate *localFunction = [[UIApplication sharedApplication] delegate];
[localFunction composeBar:YES];
BOOL* isn't a boolean. It's a pointer to a boolean. Just use
- (void)composeBar:(BOOL)savePars
You're likely confused because all Obj-C objects are declared with the *, but that's because they're actually pointers. However, BOOL is not an object, it's actually just a char which holds 0 or 1. Just as you would use int for an integer instead of int* (or in more idiomatic code, NSInteger), you use BOOL instead of BOOL*.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With