iosobjective-csprite-kitmfmailcomposeviewcontroller

dismiss MFMailComposeViewController from SKScene


I open MFMailComposeViewController from SKScene in this way:

-(void)sendmail {

if ([MFMailComposeViewController canSendMail]) {

    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
    mailer.delegate = self;
    NSArray *recipients = [NSArray arrayWithObjects:@"nothing@gmail.com", nil];
    [mailer setToRecipients:recipients];

    UIViewController *vc = self.view.window.rootViewController;
    [vc presentViewController:mailer animated:YES completion:nil];
 }
}

and this works, but after when i want return to SKScene the delegate method is not called and are unable to go back.

this is .h of SKScene:

 @interface SettingScene : SKScene <UINavigationControllerDelegate, MFMailComposeViewControllerDelegate>

what's wrong?

thanks


Solution

  • Let's set,

    mailer.mailComposeDelegate = self;
    

    while presenting mailer.