I have a uitableview 'A' which has cells, on clicking one of the cell, it needs to push another table view 'B'. and now when a cell is clicked in 'B', its needs to open a simple view.
I have managed to display both the tables in two different views. but when a cell is clicked in the menu B. it hangs and shows the below message
> unrecognized selector sent to > instance
could someone please tell me how do i solve this.thanks
Please find below my code
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
NSLog(@"entering the if loop libdecripviewcontoller");
if(self.libraryDescripViewController == nil){
NSLog(@"its creating new instance of libdecripviewcontoller");
LibraryDescripViewController *aLib = [[LibraryDescripViewController alloc] initWithNibName:@"LibraryDescripView" bundle:nil];
self.libraryD开发者_开发知识库escripViewController = aLib;
[aLib release];
}
libraryDescripViewController.title = [NSString stringWithFormat:@"%@",[libraryMenu objectAtIndex:row]];
ULS1AppDelegate *delegate = [[UIApplication sharedApplication] delegate ];
[delegate.searchLibNavController pushViewController:libraryDescripViewController animated:YES];
}
Please find the output below
2010-06-27 20:13:15.521 ULS1[1020:207] entering the if loop libdecripviewcontoller 2010-06-27 20:13:15.533 ULS1[1020:207] its creating new instance of libdecripviewcontoller 2010-06-27 20:13:15.541 ULS1[1020:207] * -[LibraryMenuTabViewController setLibraryDescripViewController:]: unrecognized selector sent to instance 0x3c2ec70 2010-06-27 20:13:15.554 ULS1[1020:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[LibraryMenuTabViewController setLibraryDescripViewController:]: unrecognized selector sent to instance 0x3c2ec70' 2010-06-27 20:13:15.558 ULS1[1020:207] Stack: ( 29303899, 2512004361, 29685819, 29255286, 29107906, 14755, 3050054, 3033220, 287146, 29088448, 29084744, 37393941, 37394138, 2777007, 11184, 11038 )
You can get more information about where the error is happening by opening your debugger window, clicking on "Show Breakpoints", and setting the following two breakpoints:
[NSException raise]
objc_exception_throw
Now when your app is about to crash, the debugger will usually show you exactly what line of code is causing the problem.
For this reason, it's good practice to have these breakpoints on every app you are developing.
It seems that you are calling "self.libraryDescripViewController = aLib" which is another way of writing [self setLibraryDescripViewController:alib].
The most likely cause of this would be in that you haven't declared the method setLibraryDescripViewController in your class.
Hope this helps.
There is way too little information here to diagnose exactly whats causing this, but one thing is certain. The method you are sending to the object is not defined for that object. Please post the code thats causing the error and the .h and .m files for the simple view you are talking about.
You probably need to set the class of the view controller in IB to LibraryDescripViewController. Double click the LibraryDescripViewController.xib file in xcode and when IB opens, in the identity view of the file's owner set the class to LibraryDescripViewController
精彩评论