Pao*_*.nl 2 llvm compiler-warnings ios
我有一个UIView子类用作自定义警报视图,它声明了这个init方法
@interface THAlertView : UIView
- (id) initWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString*)cancelButtonTitle
otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
@end
Run Code Online (Sandbox Code Playgroud)
在实现文件中,我只是定义该方法
@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
}
Run Code Online (Sandbox Code Playgroud)
带有LLVM 4.2的XCode 4.6.3给了我这个警告
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.
Run Code Online (Sandbox Code Playgroud)
我明白警告是什么,但这次我不知道如何解决它.对我来说一切似乎都很好,但也许我错过了一些东西.可能是因为NS_REQUIRES_NIL_TERMINATION宏吗?
NS_REQUIRES_NIL_TERMINATION从实现文件中删除:
@implementation THAlertView
- (id) initWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString*)cancelButtonTitle
otherButtonTitles:(NSString*)otherButtonTitles, ... {
// Create and return an instance of THAlertView
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
464 次 |
| 最近记录: |