은 내가 단순히 방법을 정의 구현 파일에서이 init 메소드이 경고를 이해할 필요가있다 "는 메소드 구현에 속성과 그 선언은 일치해야합니다"
@interface THAlertView : UIView
- (id) initWithTitle:(NSString *)title message:(NSString *)message
cancelButtonTitle:(NSString*)cancelButtonTitle
otherButtonTitles:(NSString*)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
@end
를 선언 사용자 정의 경고보기로 사용되는 UIView 하위이 LLVM 4.2
@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
}
엑스 코드 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.
경고에 관한 내용을 이해하지만 이번에는 수정 방법을 모르겠습니다. 나에게는 모든 것이 잘 보이지만 어쩌면 나는 뭔가를 놓치고있다. NS_REQUIRES_NIL_TERMINATION 매크로 때문일 수 있습니까?
확인 [이 답변] (http://stackoverflow.com/a/4894023/1407017), 유용 할 수 있습니다. – Amar
이 오류는 일반적으로 메소드 헤더가 구현과 동일하지 않다는 것을 의미합니다. yourClass.m 파일에 - (void) doSomething : (NSString *) param {...}이있는 반면에 - (void) doSomething : (int) param이 yourClass.h 파일에있을 수 있습니다. – Zhang