A lot of my memory leaks are coming from this code that recognizes swipes. What am I doing wrong? The first line is something that I think is leaking (using Instruments). It's being shown as the responsible caller for a lot of the errors This is in ViewDidLoad:
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction:)];
[(UISwipeGestureRecognizer *)swipeRight setNumberOfTouchesRequired:2];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.delegate = self;
[webView addGestureRecognizer:swipeRight];
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)];
[(UISwipeGestureRecognizer *)swipeLeft setNumberOfTouchesRequired:2];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft.delegate = self;
[webView addGestureRecognizer:swipeLeft];
// Do any additional setup after loading the view from its nib.
}
One more question, what could cause a zombie here? Should I be autoreleasing?
AViewController *a = [[AViewController alloc]init];
[self.navigationController pushViewController:a animated:YES];
a.title =@"A View";
[a release];
Update 3: I ran instruments to look for bad allocations and with some intensive use I get a zombie here:
Error Message: An Objective-C message was sent to a deallocated object (zombie) at address: 0xf583270.
In instruments here's what I'm seeing. Instruments highlights this line and has 100% next to it.
AViewController *a = [[AViewController alloc]init];