我试图让我的头绕着iPhone的Objective-C。到目前为止,我的应用程序正在编译并运行良好,但是我收到了编译器警告,我无法摆脱。XCode编译器警告:'foo'可能不会响应到-bar
报头为:一类:(剪断)
@interface PersonDetailViewController : UIViewController {
NSDictionary *person;
}
@property (retain) NSDictionary *person;
@end
实现这个类:(也剪断)
#import "PersonDetailViewController.h"
@implementation PersonDetailViewController
@synthesize person;
@end
我创造PersonListViewController的PersonDetailViewController的实例,并美其名曰:
#import "PersonListViewController.h"
#import "Person.h"
#import "PersonDetailViewController.h"
@implementation PersonListViewController
- (IBAction)myMethod:(id)sender {
NSDictionary *person = [[Person alloc] initFromTestArray:[sender tag]];
[personDetailViewController setPerson:person];
[[personDetailViewController person] describe];
}
@end
然后我通知:
warning: 'UIViewController' may not respond to '-setPerson' (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)
warning: 'UIViewController' may not respond to '-person'
它实际上反应不错,但我无法弄清楚如何安排我的头,使编译器会知道什么会回应...
我已与谷歌的希望...我已经提供了足够的信息,有人可以提供帮助。
谢谢你!
我同意第一点,但是`person`是他在头文件中声明并在执行过程中合成的属性。 – 2009-07-19 18:04:54
Ahhhh好点。我忘了@synthesize ...我会编辑我的帖子。 – micmoo 2009-07-19 18:13:29