0

我試圖集成發送郵件到我的應用程序,但我最終有2個警告。我使用的是Cocos2d框架Obj-C。這是我的代碼。試圖將郵件集成到我的應用程序,得到2個警告

-(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

您確定您的GameOver班是繼承UIViewController?這是定義您得到警告的兩種方法的類。

+0

啊,這就是問題!這只是我不知道如何讓它成爲UIVewController,因爲我需要將它保留在CCLayer上,因爲我使用的是Cocos2d。 – Joethemonkey101 2010-10-30 17:04:44

相關問題