【问题标题】:MFMailComposer - works in simulator but not in iPhone 2GMFMailComposer - 适用于模拟器但不适用于 iPhone 2G
【发布时间】:2009-09-22 12:15:16
【问题描述】:

我正在尝试将 MFMailComposer 添加到我的 iPhone 应用程序中,但在我的 iPhone 2G 中启动它并不顺利。它总是将电子邮件应用程序启动到帐户页面并关闭我的应用程序。在模拟器中像魅力一样工作。

-(void)viewWillAppear:(BOOL)动画 { [超级viewWillAppear:动画];

[self displayComposerSheet];

} -(void)displayComposerSheet {

Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
    // you have the MFMailComposeViewController class
    MFMailComposeViewController *picker =  [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

NSArray *mailArr = [[NSArray alloc] initWithObjects:self.sendTo,nil];       

[picker setSubject:@"Hello from iCamp America"];
[picker setToRecipients:mailArr];
NSString *emailBody = @"\n\n\email created with iCamp America\nwww.iCampAmerica.com";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];
[picker release];
[mailArr release];
}
else
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"You cannot send an email !" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show]; 
    [alert release]; 
}

}

【问题讨论】:

    标签: iphone


    【解决方案1】:

    MFMailComposeViewController 仅适用于 iPhone OS > 3.0。您是否在开发手机上运行该版本?

    【讨论】:

    • 是的 - 在模拟器和我的 iPhone 中运行 3.1
    【解决方案2】:

    我真傻 - 我发现发送电子邮件的调用相互冲突 - 我使用相同的动作触发器调用了 mailTo:URL 和 MFMailComposer 方法.....

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-11
      • 1970-01-01
      • 1970-01-01
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 2016-10-02
      相关资源
      最近更新 更多