我试图创建这个应用程序,当你按一个tablecell时显示ViewController,而变量get的设置在另一个视图控制器中。尽管当我按下uitablecell时,出现了一些错误。Objective C - [__ NSCFString _isAncestorOfFirstResponder]错误
错误:
2013-04-06 22:47:25.970 iFSX Guide[1069:907] Called
2013-04-06 22:47:26.009 iFSX Guide[1069:907] -[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390
2013-04-06 22:47:26.016 iFSX Guide[1069:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString _isAncestorOfFirstResponder]: unrecognized selector sent to instance 0x1d562390'
*** First throw call stack:
(0x319b22a3 0x3964c97f 0x319b5e07 0x319b4531 0x3190bf68 0x33832beb 0x338a837f 0x338548fb 0x33a95619 0x338a79b9 0x338a5fe7 0x339c83ef 0xa22a5 0x3387c28d 0x338fef81 0x322c0277 0x319875df 0x31987291 0x31985f01 0x318f8ebd 0x318f8d49 0x354ba2eb 0x3380e301 0xa19d1 0x39a83b20)
libc++abi.dylib: terminate called throwing an exception
代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)in dexPath{
NSLog(@"Called");
Aircraft = indexPath.row;
[self performSegueWithIdentifier:@"ToSections" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"ToSections"]){
AirplaneSections *sections = (AirplaneSections *)segue.destinationViewController;
sections.plane = Aircraft;
}
}
我发现,它是在视图控制器viewDidLoad方法上的错误。
NSString *quickTemp = [NSString alloc];
switch (plane) {
case 0:
quickTemp = @"Boeing 737-800";
break;
default:
break;
}
TitleLabel.text = quickTemp;
*/
我在那里做错了。
'飞机'是什么样的属性?你在使用ARC吗? – omz 2013-04-06 20:54:33
飞机是一个“int”,是的,我使用ARC – 2013-04-06 21:19:29