When I try to run this code, I get an error saying that:
Incompatible integer to pointer conversion sending 'BOOL' (aka 'signed char') to parameter of type 'BOOL *' (aka 'signed char *')
on the line
[self.MMdelegate addItemViewControllerMM:self didCheck1: checked1 didCheck2: checked2 ];
MatchModeViewController.h
@class MatchModeViewController;
@protocol MatchModeViewControllerDelegate <NSObject>
- (void)addItemViewControllerMM:(MatchModeViewController *)MMcontroller didCheck1:(BOOL *)MMbool didCheck2:(BOOL *)MMbool2;
@end
@interface MatchModeViewController : UIViewController {
BOOL checked1;
BOOL checked2;
}
@property BOOL checked1;
@property BOOL checked2;
@property (weak, nonatomic) IBOutlet UIButton *checkBoxButton1;
@property (weak, nonatomic) IBOutlet UIButton *checkBoxButton2;
- (IBAction)checkButton1:(id)sender;
- (IBAction)checkButton2:(id)sender;
@end
MatchModeViewController.m
@synthesize checkBoxButton1;
@synthesize checkBoxButton2;
@synthesize checked2;
@synthesize checked1;
- (void)viewDidLoad {
[super viewDidLoad];
checked1 = NO;
checked2 = NO;
[checkBoxButton1 setImage:[UIImage imageNamed:@"CheckBox.png"] forState: UIControlStateNormal];
[checkBoxButton2 setImage:[UIImage imageNamed:@"CheckBox.png"] forState: UIControlStateNormal];
UIBarButtonItem *saveButtonMM = [[UIBarButtonItem alloc]initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(saveButtonMMPressed)];
self.navigationItem.rightBarButtonItem = saveButtonMM;
}
-(instancetype) init {
if (self = [super init]) {
}
return self;
}
- (void) saveButtonMMPressed {
if([self.MMdelegate respondsToSelector:@selector(addItemViewControllerMM:didCheck1:didCheck2:)]){
[self.MMdelegate addItemViewControllerMM:self didCheck1: checked1 didCheck2: checked2 ];
[[NSNotificationCenter defaultCenter]postNotificationName:@"MMNOTIFICATIONNAME" object:nil];
}
[self.navigationController popViewControllerAnimated:YES ];
[self performSelector:@selector(saveButtonMMPressed) withObject:nil afterDelay:0.25];
}
I am a beginner at xcode and any help would be greatly appreciated.
BOOL *you need to get rid of the*. - rmaddyaddItemViewControllerMM:didCheck1:didCheck2? - marosoaie