无法声明另一个窗口
我试图在MyThing.m中声明另一个窗口
@property (nonatomic, strong) UIWindow *window;
但是得到这个错误
非法重新宣布类扩展“MyThing”中的财产(属性必须是“读取”,而其主要必须是“只读”)
如果我把窗口重命名为其他东西,那就OK了。 这是为什么? 窗口意味着在AppDelegate.h中声明一次?
我找出问题,它与AppDelegate.h中声明的窗口属性无关
问题是MyThing符合UIApplicationDelegate,并且UIApplicationDelegate协议声明一个属性
@property (nonatomic, retain) UIWindow *window NS_AVAILABLE_IOS(5_0);
所以我们必须做这些
MyThing.h (像AppDelegate.h一样)
@interface MyThing : NSObject <UIApplicationDelegate> @property (nonatomic, strong) UIWindow *window; @end
要么
MyThing.m (合成协议中声明的窗口属性)
@implementation WYNAppDelegate @synthesize window; @end