类扩展“AppDelegate”中属性的非法重新声明(属性必须是“readwrite”,而其主属性必须是“readonly”)

Cig*_*llo 5 properties objective-c ios

我移动了这一行:

@property (nonatomic, retain) IBOutlet UIWindow *window;
Run Code Online (Sandbox Code Playgroud)

进入我的应用程序委托中的类扩展,但现在收到此错误:

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

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

@interface AppDelegate()
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
Run Code Online (Sandbox Code Playgroud)

有什么问题?

小智 1

您粘贴的代码对于分析问题的影响较小。

但是,根据我的猜测,您可能可以从 .m 文件中删除该声明。

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

Objective-C:(私有/公共属性)使属性对于外部类调用为只读,对于自身调用为读写