尝试将Mail集成到我的应用程序中,获得2个警告

时间:2010-10-30 14:51:29

标签: objective-c email integration cocos2d-iphone mfmailcomposeviewcontroller

我正在尝试将发送邮件集成到我的应用中,但我最终收到2条警告。我正在使用Obj-C,即Cocos2d框架。这是我的代码。

    -(void) mailTapped: (id) sender {
 MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
 composer.mailComposeDelegate = self;
 if ([MFMailComposeViewController canSendMail]) {
  [composer setToRecipients:[NSArray arrayWithObjects:@"", nil]];
  [composer setSubject:@"Check Out This Awesome App!"];
  [composer setMessageBody:@"I found this great game on the App Store! It's called Mole Attack. It's a side scroller with an epic story. You can check out some screenshots of the gameplay and download it here. Download link - " isHTML:NO]; //Include link and pics
  [self presentModalViewController:composer animated:YES];  // <--- warning - GameOver (name of class) may not respond to '-presentModalViewController:animated:'
 }
} 

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
 [self dismissModalViewControllerAnimated:YES]; // <--- warning - GameOver may not respond to '-dismissModalViewControllerAnimated:YES'
 if (result == MFMailComposeResultFailed) {
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failed" message:@"The email was not sent. You must be in wifi or 3G range. Try again later." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
  [alert show];
  [alert release];
 }
}

提前致谢!

1 个答案:

答案 0 :(得分:1)

您确定GameOver课程是继承自UIViewController吗?这是定义您正在收到警告的两种方法的类。