Cocoa touch 为什么';t XCode意识到我';你综合了我的财产?
在我的界面中,我有:Cocoa touch 为什么';t XCode意识到我';你综合了我的财产?,cocoa-touch,properties,warnings,xcode4,Cocoa Touch,Properties,Warnings,Xcode4,在我的界面中,我有: #import <UIKit/UIKit.h> @protocol AddCategoryDelegate; @interface AddCategoryViewController : UIViewController { id <AddCategoryDelegate> _delegate; } @property (nonatomic, assign, readwrite) id <AddCategoryDelegate&
#import <UIKit/UIKit.h>
@protocol AddCategoryDelegate;
@interface AddCategoryViewController : UIViewController {
id <AddCategoryDelegate> _delegate;
}
@property (nonatomic, assign, readwrite) id <AddCategoryDelegate> delegate;
@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *textLabel;
- (IBAction)saveAction:(id)sender;
@end
@protocol AddCategoryDelegate <NSObject>
- (void)addCategoryViewController:(AddCategoryViewController *)addCategoryViewController didAddCategory:category;
@end
但我一直从XCode收到以下警告:
属性“textLabel”需要
要定义的方法“setTextLabel:”-
使用@synthetic、@dynamic或提供
方法实现
属性“textLabel”需要
要定义的方法'-textLabel'-
使用@synthetic、@dynamic或提供
方法实现
这是一个XCode 4错误,还是我做错了什么?值得注意的是:复制上述代码不会导致安装时出现警告。你能确保真实代码中没有输入错误吗
否则,您可以尝试从变量声明中删除
IBOutlet
关键字,并仅将其保留在属性声明中。这可能会让人困惑……拥有两个IBoutlet似乎肯定会是个问题;因为我认为IB会同时看到这两个,而你无法分辨哪个是哪个。此外,根本不需要申报iVar@Synthetic将自动执行此操作。谢谢-我已删除IVAR,但错误消息仍然相同。我已经编辑了我上面的问题,所以它是实际代码的复制和粘贴,以防我遗漏了输入错误。好的。。。谷歌搜索发现有人有类似的问题。我从产品菜单中选择了“清洁”,这似乎已经解决了它!现在,如果有人愿意告诉我什么是“干净”,以及我刚才做了什么……:)您完全删除了所有中间构建信息,并强制Xcode从头开始重建所有内容。显然存在一些它没有检测到的问题,因此清理目标并重建它纠正了这种情况。仅供参考:同样的问题在这里和运行clean没有解决。事实上,当我一擦干净,所有的警告都消失了,除了那个。。。当它分析我的代码时(大约0.25秒),另一个警告也出现了。关闭和重新打开项目对我来说很有效。
#import "AddCategoryViewController.h"
@implementation AddCategoryViewController
@synthesize delegate = _delegate;
@synthesize textField;
@synthesize textLabel;
// methods
@end