このinitメソッドを宣言するカスタムアラートビューとして使用されるUIViewサブクラスがあります
@interface THAlertView : UIView
- (id) initWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString*)cancelButtonTitle
otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
@end
実装ファイルでは、そのメソッドを定義するだけです
@implementation THAlertView
- (id) initWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString*)cancelButtonTitle
otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION {
// Create and return an instance of THAlertView
}
XCode 4.6.3 で LLVM 4.2 を使用すると、この警告が表示されます
THAlertView.m:74:193: warning: attributes on method implementation and its declaration must match [-Wmismatched-method-attributes]
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION {
^
THAlertView.h:29:1: note: method 'initWithTitle:message:cancelButtonTitle:otherButtonTitles:' declared here
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
^
1 warning generated.
警告の内容は理解できますが、今回は修正方法がわかりません。私にはすべて問題ないように見えますが、何かが足りないのかもしれません。NS_REQUIRES_NIL_TERMINATION マクロが原因でしょうか?