【问题标题】:didFinishWithResult is not getting invoked for MFMailComposeViewController没有为 MFMailComposeViewController 调用 didFinishWithResult
【发布时间】:2012-05-18 21:17:52
【问题描述】:

在按键回调中:

 MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
    mailViewController.mailComposeDelegate = self;

    [self presentModalViewController:mailViewController animated:YES];

委托实施:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
NSLog (@" Inside  MAIL COMPOSER CONTROLLER DELIGATE ");


// Remove the mail view
[self dismissModalViewControllerAnimated:YES];
}

当我在 MailComposerView 中按下取消按钮时,不会调用删除。我做错了什么?

【问题讨论】:

    标签: iphone objective-c ios4 ios5


    【解决方案1】:
    1. 将您的 viewController 设置为 MFMailComposeViewControllerDelegate:

      @interface CurrentViewController : UIViewController <MFMailComposeViewControllerDelegate>
      
    2. 在实例化后立即设置您的 mailComposer 委托:

      MFMailComposeViewController * mailComposer = [[MFMailComposeViewController alloc]init];
      mailComposer.mailComposeDelegate = self;
      

    【讨论】:

      【解决方案2】:

      你真的让你的类成为 MFMailComposeViewControllerDelegate 吗?

      @interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
      

      【讨论】:

      • 这不会导致方法不被调用;它只会在setDelegate: 行引起编译器警告。
      • 好电话。除此之外,我没有任何想法。
      猜你喜欢
      • 2016-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      相关资源
      最近更新 更多