warning: 'Xxx' may not respond to '-xxx'
■下記のクラスをビルドしたら警告が発生した。
ClockAppDelegate.m
@implementation ClockAppDelegate - (void) setupTimeAnnounce { // 時報用のタイマーを生成 timerAnnounce = [ NSTimer scheduledTimerWithTimeInterval: 60.0f ]; ---略--- } @end
■警告の内容
warning: 'ClockAppDelegate' may not respond to '-setupTimeAnnounce' warning: Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
ヘッダファイルにsetupTimeAnnounceメソッドが宣言されていない。
ちなみに、警告なのでビルド、実行することはできる。
■対応
ヘッダファイルにメソッド名を宣言する。
ClockAppDelegate.h
@interface ClockAppDelegate : NSObject <UIApplicationDelegate> { } @property (nonatomic, retain) IBOutlet UIWindow *window; - (void) setupTimeAnnounce; // ここに追加 @end