【发布时间】:2011-07-08 09:47:11
【问题描述】:
我想使用单例 UIApplication 来访问 AppDelegate 的 managedObjectContext。但是当我写
[[[UIApplication sharedApplication] delegate] managedObjectContext]
或
[[[UIApplication sharedApplication] delegate] __managedObjectContext]
它不起作用。
但是这条线工作正常:
NSLog(@"Seeking for the AppDelegate : %@", [[[UIApplication sharedApplication] delegate] class]);
你有解决办法吗? 尼尔斯
【问题讨论】:
标签: iphone ios singleton nsmanagedobjectcontext application-singleton