我正在构建一个 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];
}
}