在类扩展'AppDelegate'中非法重新声明属性(属性必须为'readwrite',而其主要属性必须为'readonly')

时间:2015-03-11 17:53:39

标签: ios objective-c properties

我移动了这一行:

@property (nonatomic, retain) IBOutlet UIWindow *window;

到我的App Delegate中的类扩展中,但现在出现此错误:

Illegal redeclaration of property in class extension 'AppDelegate' (attribute must be 'readwrite', while its primary must be 'readonly')

.m文件中的完整代码如下所示:

@interface AppDelegate()
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end

问题是什么?

1 个答案:

答案 0 :(得分:0)

您粘贴的代码重量较轻,无法分析问题。

但是,从我猜测,你可能会删除.m文件中的声明。

您可以在以下链接中找到更多信息。

Objective-C : (private / public properties) making a property readonly for outside class calls and readwrite for self calls