سؤال

The error reads Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MObject objectAtIndex:]: unrecognized selector sent to instance. So, what I get out of that is that an instance of MObject (a subclass of NSObject) is receiving an objectAtIndex: message that it isn't meant to handle.

The error occurs when I tap on a table row to go to its detail view, which consists of a UIWebView detailWebView. The code for didSelectRowAtIndexPath is as follows:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MObjectDetailVC *mObjectDetailVC = [[MObjectDetailVC alloc] initWithNibName:@"MObjectDetailVC" bundle:nil];
mObjectDetailVC.detailURL = [[NSURL alloc] initWithString:[[[mcData objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] url]];
mObjectDetailVC.title = [[[mcData objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] name];
[self.navigationController pushViewController:mObjectDetailVC animated:YES];
[mObjectDetailVC release];
}

It's taking the NSString url property of the selected instance of MObject and turning it into an NSURL for the detail view controller, which just does the basic [detailWebView loadRequest:[NSURLRequest requestWithURL:detailURL]].

If you have any suggestions, I'll be glad to hear them. And if you need further information, please let me know.

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top