'无法识别的选择器发送到实例'

问题描述:

我收到以下错误

[UIViewController setThisViewData:]: unrecognized selector sent to instance 0x71800b0
2012-10-24 16:06:05.071 Movie Rental[5468:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setThisViewData:]: unrecognized selector sent to instance 0x71800b0'

basicInfoViewController.m 的以下行:

 contactInfoViewController *destViewController = segue.destinationViewController;
 destViewController.thisViewData = [[NSMutableDictionary alloc] initWithDictionary:self.viewData];

我的 contactInfoViewController.h 看起来像

@interface contactInfoViewController : UIViewController
{
    NSMutableDictionary *thisViewData;
}
@property(nonatomic, strong) NSMutableDictionary *thisViewData;

我已包含

@synthesize thisViewData;


为什么我得到这个错误?

for the implementation. Why am I getting this error ?

看起来你还没有为接口UIViewController设置类生成器,而不是得到一个contactInfoViewController你得到一个UIViewController。

Looks like you haven't set the class for the UIViewController in interface builder so instead of getting a contactInfoViewController you are getting a UIViewController.