Using a GestureRecognizer connected to a view causes my application to crash with an EXC_BAD_ACCESS error. Classes involved here
β’ BoardViewController . Displays the board (as a background) installed as rootViewController in AppDelegate. It creates several "TaskViewcontroller" objects.
//BoardViewController.h @interface BoardViewController : UIViewController { NSMutableArray* allTaskViews; //for storing taskViews to avoid having them autoreleased }
//BoardViewController.m - Rootviewcontroller, instantiating TaskViews - (void)viewDidLoad { [super viewDidLoad]; TaskViewController* taskA = [[TaskViewController alloc]init]; [allTaskViews addObject:taskA]; [[self view]addSubview:[taskA view]]; }
β’ TaskViewController . - A separate field displayed on the board. It needs to be dragged. So I applied UIPanGestureRecoginzer to his opinion
- (void)viewDidLoad { [super viewDidLoad]; UIPanGestureRecognizer* panRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePan:)]; [[self view] addGestureRecognizer:panRecognizer]; } - (void)handlePan:(UIPanGestureRecognizer *)recognizer { NSLog(@"PAN!"); }
The .xib file is a simple view.

All programming with a gesture recognizer I would prefer to do in code. Any idea how to fix the error that caused the application to crash?
Bernd source share