My app has a navigation controller and two views, firstController and secondController. firstController has a webView that displays an html page with links, and clicking any link will take the user to secondController. This is where the program stops by stepping through the debugger.
See code below.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
secondController *nextController = [[secondController alloc] init];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];
return NO;
}
return YES;
}
This works fine except for when I navigate from firstController to secondController by clicking any link on firstController the third time, the application just exits.(firstController link click, secondController back button, firstController link click, secondController back button, firstController link click and the application crashes)
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFSet length]: unrecognized selector sent to instance 0x251f100'
This is so strange. I've tried everything but still couldn't figure out what went wrong.