MessageUI iphone sdk。从不兼容类型'FlipsideViewController </mfmailcomposeviewcontrollerdelegate>分配给'id <mfmailcomposeviewcontrollerdelegate>'

时间:2012-03-04 23:23:25

标签: iphone ios sdk messageui

我正在构建一个iphone应用程序,它涉及视频播放器,音频播放器以及更多xcode 4.2基本上问题是发送电子邮件功能(反馈)。我的代码很好,没有错误,但当我运行应用程序时,它一直给出这些问题,当我点击按钮“反馈”,用户发送电子邮件,它崩溃。有人可以帮忙吗?

我得到的语义问题:

1)警告:从此行中的不兼容类型'FlipsideViewController *'[3]分配给'id':mailMe.mailComposeDelegate = self;

2)警告:此行中不完整的实施[-Wincomplete-implementation,3]:

@implementation FlipsideViewController

这是我的flipsideview.h:

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


@class FlipsideViewController;

@protocol FlipsideViewControllerDelegate
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller;
@end

@interface FlipsideViewController : UIViewController

@property (nonatomic, assign) IBOutlet id <FlipsideViewControllerDelegate,MFMailComposeViewControllerDelegate> delegate;

- (IBAction)done:(id)sender;
-(IBAction)website1:(id)sender;
-(IBAction)sentMail2:(id)sender;


@end

和我的flipsideview.m(已发送邮件按钮)

-(IBAction)sentMail2 {
    MFMailComposeViewController *mailMe = [[MFMailComposeViewController alloc] init];
    mailMe.mailComposeDelegate = self;
    if ([MFMailComposeViewController canSendMail]) {
        [mailMe setToRecipients:[NSArray arrayWithObjects:@"my-email@e-mail.com",nil]];
        [mailMe setSubject:@"Feedback"];
        [mailMe setMessageBody:@"Name:(your name)., Please type your details correctly before sending the e-mail." isHTML:NO];
        [self presentModalViewController:mailMe animated:YES];
    }
    [mailMe release];

} - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    [self dismissModalViewControllerAnimated:YES];

    if (result == MFMailComposeResultSent) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message Sent!" message:@"Your message has been sent! \n Thank you for your feedback" delegate:self cancelButtonTitle:@"Okay!" otherButtonTitles:nil];
        [alert show];
        [alert release];
    } if (result == MFMailComposeResultFailed) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message Failed" message:@"Your email has failed to send \n Please try again" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
        [alert show];
        [alert release];
    }
}

1 个答案:

答案 0 :(得分:0)

您的合规代表商标位置错误。将它们放在@interface指定超类

的部分之后