我在AppDelegate
有一个属性,我想轻松抓住。到目前为止,它并没有按计划为我工作:
[(AppDelegate *)[UIApplication sharedApplication] wasLoggedIn] = YES
@property (nonatomic, assign) BOOL wasLoggedIn;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
wasLoggedIn = false;
}
我做错了什么?
答案 0 :(得分:1)
[(AppDelegate *)[UIApplication sharedApplication] wasLoggedIn] = YES;
应该是
[(AppDelegate *)[[UIApplication sharedApplication] delegate] wasLoggedIn] = YES;
您此刻正在调用UIApplication实例上的方法。