【问题标题】:unrecognized selector sent to instance, reason无法识别的选择器发送到实例,原因
【发布时间】:2012-06-06 19:27:01
【问题描述】:

每当我打电话时

self.gLViewController = [[GLViewController alloc] initWithNibName:@"GLViewController" bundle:nil];
       [self.navigationController pushViewController:self.gLViewController animated:YES]; 

我收到以下错误:

2012-06-06 15:22:50.329 NavApp[5357:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MiniGamesViewController setGLViewController:]: unrecognized selector sent to instance 0x1f6aa730'
*** First throw call stack:
(0x353b788f 0x3775e259 0x353baa9b 0x353b9915 0x35314650 0xb14cf 0x353113fd 0x32e06e07 0x32e06dc3 0x32e06da1 0x32e06b11 0x32e07449 0x32e0592b 0x32e05319 0x32deb695 0x32deaf3b 0x36faa22b 0x3538b523 0x3538b4c5 0x3538a313 0x3530d4a5 0x3530d36d 0x36fa9439 0x32e19cd5 0xaeae5 0x60ce4)
terminate called throwing an exception(lldb) 

谁能帮我准确地告诉我这是在说什么?我已经为此工作了整整一个小时,但一无所获。非常感谢您的帮助!

【问题讨论】:

  • 在 GLViewController 中,如果您使用的是界面生成器,请确保 GLViewController 的视图链接到文件所有者

标签: objective-c ios xcode exception


【解决方案1】:

你必须合成属性 在你的MiniGamesViewController.m

//After the implementation
@implementation MiniGamesViewController
//Add this line
@synthesize gLViewController;

【讨论】:

  • 编辑:好像我忘记了...现在添加。
  • 发生的事情比你想象的要多:),如果对你有帮助,请不要忘记投票和/或接受答案:)
  • 如果您没有为声明的属性提供实现,编译器应该会警告您,方法是手动定义访问器、@synthesize@dynamic。您可能想要设置将警告升级为错误的构建设置。
猜你喜欢
  • 2015-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多