Попытка интегрировать почту в мое приложение, получая 2 предупреждения - PullRequest
0 голосов
/ 30 октября 2010

Я пытаюсь интегрировать отправку почты в свое приложение, но в итоге получаю 2 предупреждения. Я использую Obj-C, Cocos2d Framework. Это мой код.

    -(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 Ответ

1 голос
/ 30 октября 2010

Вы уверены, что ваш класс GameOver наследуется от UIViewController? Это класс, который определяет два метода, о которых вы получаете предупреждения.

...