我有一个基于Windows的iPhone应用程序。我有标签,我从其中一个标签中切换另一个页面并在该页面的webview中显示facebook。我将无法识别的选择器发送到实例错误。
这是我尝试切换的代码:
-(IBAction)goFacebookPage:(id)sender
{
FacebookPage *fbController = [[FacebookPage alloc] initWithNibName:@"FacebookPage" bundle:nil];
fbController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:fbController animated:YES];
[fbController release];
}
2012-03-02 15:29:13.797 TPFApp[2344:b903] -[UIViewController goFacebookPage:]: unrecognized selector sent to instance 0x6818540
2012-03-02 15:29:13.868 TPFApp[2344:b903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController goFacebookPage:]: unrecognized selector sent to instance 0x6818540'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dc40bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d33966 ___forwarding___ + 966
4 CoreFoundation 0x00d33522 _CF_forwarding_prep_0 + 50
5 UIKit 0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x000a4799 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000a6c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x000a57d8 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x00038ded -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x00019c37 -[UIApplication sendEvent:] + 447
11 UIKit 0x0001ef2e _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x00ffb992 PurpleEventCallback + 1550
13 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
16 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x00ffa1c4 GSEventRunModal + 217
19 GraphicsServices 0x00ffa289 GSEventRun + 115
20 UIKit 0x00022c93 UIApplicationMain + 1160
21 TPFApp 0x00001e19 main + 121
22 TPFApp 0x00001d95 start + 53
)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
-[UIViewController goFacebookPage:]: unrecognized selector sent to instance 0x6894210 2012-03-01 21:10:53.218 TPFApp[1750:b903]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController goFacebookPage:]: unrecognized selector sent to instance 0x6894210'
由于
答案 0 :(得分:1)
错误告诉您,在消息中命名的选择器(函数)被“发送”到错误类型的对象。
如果您甚至包含了最新的附加信息(例如完整信息的副本),我们将能够提供更多建议。
答案 1 :(得分:0)
找到您正在呼叫的课程 goFacebookPage:
,并确保该课程与您从中呼叫的课程相同。
答案 2 :(得分:0)
在Interface Builder中,您已将控件(例如UIButton
?)连接到View Controller。但是,您尚未将View Controller的类型设置为自定义视图控制器,而是将其连接到UIViewController
的默认实例。
要解决此问题,您需要将View Controller的类型更改为自定义视图控制器的类(您定义goFacebookPage:
方法的类。您可以在Interface Builder中的Identity Inspector中执行此操作 - 见这里: