每当按下按钮时应用程序就会崩溃
首先,我想说我是 iPhone 开发的新手,并且我可能遗漏了一件明显的事情。
我有一个基于视图的应用程序。我进入“MainWindow.xib”,并将“Nib Name”更改为“MainMenu”,即我的应用程序菜单的 xib 的名称。我在那里有一个按钮,连接到一个操作(showWordChooser),每当按下该按钮时,应用程序就会崩溃。
调试器内容:
2011-01-07 15:56:01.987 NCEAVerbs[20479:207] -[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0
2011-01-07 15:56:01.990 NCEAVerbs[20479:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00da7be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00efc5c2 objc_exception_throw + 47
2 CoreFoundation 0x00da96fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d19366 ___forwarding___ + 966
4 CoreFoundation 0x00d18f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x00012a6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x000a11b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000a3647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x000a21f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x000370d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0001837a -[UIApplication sendEvent:] + 447
11 UIKit 0x0001d732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x0101ca36 PurpleEventCallback + 1550
13 CoreFoundation 0x00d89064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00ce96f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00ce6983 __CFRunLoopRun + 979
16 CoreFoundation 0x00ce6240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00ce6161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x0101b268 GSEventRunModal + 217
19 GraphicsServices 0x0101b32d GSEventRun + 115
20 UIKit 0x0002142e UIApplicationMain + 1160
21 NCEAVerbs 0x00001b64 main + 102
22 NCEAVerbs 0x00001af5 start + 53
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
如果我执行 bt:
(gdb) bt
#0 0x90a16176 in __kill ()
#1 0x90a16168 in kill$UNIX2003 ()
#2 0x90aa889d in raise ()
#3 0x90abe9bc in abort ()
#4 0x99a16fba in __gnu_cxx::__verbose_terminate_handler ()
#5 0x00efc4e7 in _objc_terminate ()
#6 0x99a1515a in __cxxabiv1::__terminate ()
#7 0x99a1519a in std::terminate ()
#8 0x99a15298 in __cxa_throw ()
#9 0x00efc635 in objc_exception_throw ()
#10 0x00da96fb in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#11 0x00d19366 in ___forwarding___ ()
#12 0x00d18f22 in __forwarding_prep_0___ ()
#13 0x00012a6e in -[UIApplication sendAction:to:from:forEvent:] ()
#14 0x000a11b5 in -[UIControl sendAction:to:forEvent:] ()
#15 0x000a3647 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#16 0x000a21f4 in -[UIControl touchesEnded:withEvent:] ()
#17 0x000370d1 in -[UIWindow _sendTouchesForEvent:] ()
#18 0x0001837a in -[UIApplication sendEvent:] ()
#19 0x0001d732 in _UIApplicationHandleEvent ()
#20 0x0101ca36 in PurpleEventCallback ()
#21 0x00d89064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#22 0x00ce96f7 in __CFRunLoopDoSource1 ()
#23 0x00ce6983 in __CFRunLoopRun ()
#24 0x00ce6240 in CFRunLoopRunSpecific ()
#25 0x00ce6161 in CFRunLoopRunInMode ()
#26 0x0101b268 in GSEventRunModal ()
#27 0x0101b32d in GSEventRun ()
#28 0x0002142e in UIApplicationMain ()
#29 0x00001b64 in main (argc=1, argv=0xbffff08c) at /Developer/Projects/NCEAVerbs/NCEAVerbs-main.m:13
(gdb)
我真的不知道发生了什么,请帮助:)
First of all, I'd like to say that I am a total newbie to iPhone development, and that there is probably an obvious thing i'm missing.
I have a view based application. I went into "MainWindow.xib", and changed the "Nib Name" to "MainMenu", the name of my app's menu's xib. I have a button in there, connected to an action (showWordChooser), and whenever the button is pressed the app crashes.
Debugger contents:
2011-01-07 15:56:01.987 NCEAVerbs[20479:207] -[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0
2011-01-07 15:56:01.990 NCEAVerbs[20479:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00da7be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00efc5c2 objc_exception_throw + 47
2 CoreFoundation 0x00da96fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d19366 ___forwarding___ + 966
4 CoreFoundation 0x00d18f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x00012a6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x000a11b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000a3647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x000a21f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x000370d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0001837a -[UIApplication sendEvent:] + 447
11 UIKit 0x0001d732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x0101ca36 PurpleEventCallback + 1550
13 CoreFoundation 0x00d89064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00ce96f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00ce6983 __CFRunLoopRun + 979
16 CoreFoundation 0x00ce6240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00ce6161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x0101b268 GSEventRunModal + 217
19 GraphicsServices 0x0101b32d GSEventRun + 115
20 UIKit 0x0002142e UIApplicationMain + 1160
21 NCEAVerbs 0x00001b64 main + 102
22 NCEAVerbs 0x00001af5 start + 53
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
if i do a bt:
(gdb) bt
#0 0x90a16176 in __kill ()
#1 0x90a16168 in kill$UNIX2003 ()
#2 0x90aa889d in raise ()
#3 0x90abe9bc in abort ()
#4 0x99a16fba in __gnu_cxx::__verbose_terminate_handler ()
#5 0x00efc4e7 in _objc_terminate ()
#6 0x99a1515a in __cxxabiv1::__terminate ()
#7 0x99a1519a in std::terminate ()
#8 0x99a15298 in __cxa_throw ()
#9 0x00efc635 in objc_exception_throw ()
#10 0x00da96fb in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#11 0x00d19366 in ___forwarding___ ()
#12 0x00d18f22 in __forwarding_prep_0___ ()
#13 0x00012a6e in -[UIApplication sendAction:to:from:forEvent:] ()
#14 0x000a11b5 in -[UIControl sendAction:to:forEvent:] ()
#15 0x000a3647 in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#16 0x000a21f4 in -[UIControl touchesEnded:withEvent:] ()
#17 0x000370d1 in -[UIWindow _sendTouchesForEvent:] ()
#18 0x0001837a in -[UIApplication sendEvent:] ()
#19 0x0001d732 in _UIApplicationHandleEvent ()
#20 0x0101ca36 in PurpleEventCallback ()
#21 0x00d89064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#22 0x00ce96f7 in __CFRunLoopDoSource1 ()
#23 0x00ce6983 in __CFRunLoopRun ()
#24 0x00ce6240 in CFRunLoopRunSpecific ()
#25 0x00ce6161 in CFRunLoopRunInMode ()
#26 0x0101b268 in GSEventRunModal ()
#27 0x0101b32d in GSEventRun ()
#28 0x0002142e in UIApplicationMain ()
#29 0x00001b64 in main (argc=1, argv=0xbffff08c) at /Developer/Projects/NCEAVerbs/NCEAVerbs-main.m:13
(gdb)
I really have no idea what's going on, please help :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您显然正在尝试在某处调用 showWordChooser,但您正在调用的位置中不存在该函数。
You are apparently trying to call the
showWordChooser
somewhere, which does not exist in the location you are calling.该错误意味着您尚未定义该方法。检查方法名称是否拼写错误,或者是否将该函数放置在错误的文件中?
The error means you haven't defined the method. Check for misspelled method names, or have you placed the function in the wrong file?