2013-03-29 1 views
2

Xcode4.3 UIActionSheet 원인이 오류 메시지

가 호환되지 않는 유형의 매개 변수 '의 ViewController * const를 __strong'을 보내는 중 ... 내가 얻을 delegate:self 옆에 테스트 만하면 응용 프로그램이 완벽하게 잘 작동 'ID < UIActionSheetDelegate> '

이 문제에 대한 도움이 며칠 동안 계속되었습니다. 내 Viewcontroller.h은

은 ...

#import <UIKit/UIKit.h> 
#import <Social/Social.h> 

#import "Accounts/Accounts.h" 
#import <MessageUI/MessageUI.h> 


@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate> 

{ 
    UIAlertView *objresponseAlert; 
} 
@property (weak, nonatomic) IBOutlet UITextView *myTextView; 

- (IBAction)emailButton:(id)sender; 
@end 

그리고 내가 가진 내 ViewController.m에서

....

- (IBAction)emailButton:(id)sender {  
    UIActionSheet *actionsheet = [[UIActionSheet alloc] 
            initWithTitle:@"Title" 
            delegate:self 
            cancelButtonTitle:@"Cancel" 
            destructiveButtonTitle:nil 
            otherButtonTitles:@"Email", nil]; 
    [actionsheet showInView:self.view]; 
} 
+8

클래스를 'UIActionSheet' Delegate에 맞게 만들어야합니다. 헤더 파일에서 다음과 같이 변경하십시오 :'@interface ViewController : UIViewController ' – Malloc

+0

Brilliant! 감사. 나는 어디에서나 UIActionSheetdelegate를 타이핑 해 보았지만 didnt는 그것이 쉼표 뒤에 그것을 놓는 것만 큼 간단하다는 것을 깨닫는다! 다시 한 번 감사드립니다! – user2224531

+0

Typo, "UIActionSheetDelegate"여야합니다. "d"는 자본이어야합니다. – mikemike396

답변

5

이 완벽하게 작동합니다!

// Make Class conform to UIActionSheet delegate 
@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate,UIActionSheetDelegate>