简体   繁体   English

Objective C OSX-委托-无法识别的选择器发送到实例

[英]objective C OSX - Delegate- unrecognized selector sent to instance

The changeView_ShowContact method will make a view controller to show up just fine. changeView_ShowContact方法将使视图控制器显示得很好。 But when I call the changeView_ShowContact from another class it wont work. 但是,当我从另一个类调用changeView_ShowContact时,它将无法工作。 Im getting an error in the log "unrecognized selector sent to instance." 我在日志“无法识别的选择器发送给实例”中遇到错误。

@protocol callingActions_fromMainNavigation <NSObject>
    - (IBAction)changeView_ShowContact:(id)sender;
@end

**@interface Navigation_Main : NSViewController**
@property (nonatomic, strong) id <callingActions_fromMainNavigation> delegate;

**@implementation Navigation_Main** 
@synthesize delegate;

- (IBAction)changeView_ShowContact:(id)sender;
{
    NSLog(@"********************ShowContact");
    AddStuffViewController = [[pageContact alloc] initWithNibName:@"pageContact" bundle:nil];
    [AddStuffView addSubview:[AddStuffViewController view]]; //<This call here works ok.
}

.

@interface contacts : NSObject <callingActions_fromMainNavigation>

**@implementation contacts**
-(void)myMethodCall:(id)sender;
{
    Navigation_Main *NavMain = [[Navigation_Main alloc] initWithNibName:@"Navigation_Main.h" bundle:nil];
    [NavMain setDelegate:self];
    [self changeView_ShowContact:nil];
    //I need to call the (IBAction)changeView_ShowContact in the Main Navigation. This 
    //code is not working.
}

似乎您的contacts在没有实现contacts类中的changeView_ShowContact:情况下采用了callingActions_fromMainNavigation协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法识别的选择器已发送至实例| 目标C - unrecognized selector sent to instance | Objective C 目标-C无法识别的选择器发送到实例 - Objective - C unrecognized selector sent to instance 无法识别的选择器已发送到实例Objective-C - Unrecognized selector sent to instance Objective-C 目标C:无法识别的选择器已发送到实例0x6080000550c0 - Objective C: unrecognized selector sent to instance 0x6080000550c0 目标C-无法识别的选择器发送到实例(集合视图) - Objective C - unrecognized selector sent to instance (Collection views) [UIImageView setScrollSpeed:]: 无法识别的选择器发送到实例 - 目标 C - [UIImageView setScrollSpeed:]: unrecognized selector sent to instance - Objective C 目标C错误[__NSCFNumber长度]:无法识别的选择器已发送到实例 - Objective C error [__NSCFNumber length]: unrecognized selector sent to instance 目标 c [__NSArrayM objectForKey:]: 无法识别的选择器发送到实例 - objective c [__NSArrayM objectForKey:]: unrecognized selector sent to instance objective-c-[__ NSCFNumber length]:无法识别的选择器已发送到实例 - objective-c -[__NSCFNumber length]: unrecognized selector sent to instance Objective-C新手-UIViewController ManagedObjectContext无法识别的选择器发送到实例 - Objective-c newbie - UIViewController managedObjectContext unrecognized selector sent to instance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM