OK,这是我的情况...实例方法 - 为App委托财产
我的应用程序委托声明如下:
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (assign) ppDocumentManager* documentManager;
现在,从不同的位置我米试图访问documentManager
,像这样:
AppDelegate* de = (AppDelegate*)[[NSApplication sharedApplication] delegate];
ppDocumentManager* docs = [de documentManager];
,并在文件的顶部,我还添加了@class AppDelegate;
,以便编译器知道AppDelegate
代表什么。
它工作正常。
然而,我不断收到警告:
Instance method '-documentManager' not found (return type defaults to 'id')
我应该以消除所有的警告呢?
您将不会导入.m文件,因此没有循环导入的风险。另外,@class不会告诉编译器该类的方法和属性。 – 2013-02-16 13:48:48
@FirozeLafeer的确如此。 :-) – 2013-02-16 14:10:08