Question

I'm trying to integrate sending mail into my app, but I end up with 2 warnings. I am using Obj-C, the Cocos2d Framework. This is my code.

    -(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];
 }
}

Thanks in advance!

Was it helpful?

Solution

Are you sure your GameOver class is inheriting from UIViewController? That's the class that defines the two methods that you're getting warnings about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top