iOSプロジェクトのAppDelegateのメソッドにアクセスするために、同じプロジェクトの別のヘッダファイルに# "AppDelegate.h"をインポートしようとしています。iOS:AppDelegate.hを別のヘッダファイルに含めると、Xcodeコンパイラでエラーがスローされる原因は何ですか?
だから、私のヘッダファイルには、次のようなものになります」とすぐに私は#IMPORTとして、しかし
MyAppDelegate* appDelegate = (MyAppDelegate*)[UIApplication sharedApplication].delegate;
[appDelegate doSomething];
: の#import
#import "DataProvider.h"
#import "MyAppDelegate.h"
@interface MyViewController : UIViewController <UITextFieldDelegate, UIAlertViewDelegate> {
...
}
をし、私はこのように私AppDelegateを使用したいですMyAppDelegate.h "のように、コンパイラは多くの(無関係の)エラーをスローします。
Cannot find interface declaration for 'MyOtherViewController', superclass of 'MyOtherViewController2'
問題は次のとおりです。AppDelegateをほかのヘッダーに含めても問題ありません。その違いが何であるかは分かりません。何が原因か分かりませんか?どうもありがとう!
PS:これはGCCと新しいLLVMで発生します。
MyAppDelegate.hを投稿できますか? – giorashc