Ios 目标C---[\uu NSCFString\u isAncestorOfFirstResponder]错误
我正在尝试创建这个应用程序,当您按下一个tablecell时,您会看到ViewController,而变量get在另一个view控制器中设置。尽管我按下uitablecell时出现了一些错误 错误:Ios 目标C---[\uu NSCFString\u isAncestorOfFirstResponder]错误,ios,objective-c,xcode,Ios,Objective C,Xcode,我正在尝试创建这个应用程序,当您按下一个tablecell时,您会看到ViewController,而变量get在另一个view控制器中设置。尽管我按下uitablecell时出现了一些错误 错误: 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]: unre
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;
}
}
我发现这是viewcontroller上ViewDidLoad的一个错误
NSString *quickTemp = [NSString alloc];
switch (plane) {
case 0:
quickTemp = @"Boeing 737-800";
break;
default:
break;
}
TitleLabel.text = quickTemp;
*/
我在那里做错了什么。你在用ARC吗?这类问题通常表明某个地方存在内存错误。基本上,某个地方的一些代码试图访问一个已经发布的对象。这让一切都很顺利 如果不使用ARC,则应将其启用 之后,接下来要做的就是运行静态分析器。解决出现的任何问题 如果这不能解决问题,那么在Xcode中,添加一个断点,当抛出Objective-C异常时该断点将停止。它应该告诉你这个问题到底发生在哪里
如果没有帮助,请在Instruments和Zombie工具下运行代码。这将显示您试图访问已释放内存的确切位置。飞机的属性是什么?你用的是ARC吗?飞机是一个“int”,是的,我用的是ARC。我发现性能格是个问题,当我评论它时,应用程序可以工作,但当它在那里时,它就停止了…@JackyBoy:这看起来确实像是ARC帮助避免的内存管理错误,所以这是一个有效的建议。