【问题标题】:Iphone to use MFMailComposer to send email programmatically?Iphone 使用 MFMailComposer 以编程方式发送电子邮件?
【发布时间】:2012-06-11 08:13:39
【问题描述】:

在我的应用程序中,我使用 MFMailComposer 发送电子邮件。

在我的应用程序中,用户可以选择他想要发送和发送电子邮件的时间。

一切正常。但我所做的是,我使用 NSTimer 打开 MFMailComposeViewController 并以编程方式单击发送按钮。

但我不确定苹果是否会批准我的应用程序或拒绝。 有没有人在那个应用程序中使用过这种类型的功能,并且苹果已经批准或拒绝了那里的应用程序。请告知。

请帮帮我。

以下是我的代码:

-(void)showController {
    MFMailComposeViewController *mailController;
    //alloc, init, set properties, do whatever you normally would
    [self.navigationController presentModalViewController:mailController animated:YES];
    [mailController release];

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendMail:) userInfo:mailController repeats:NO];
}

-(void)sendMail:(NSTimer*)theTimer {
    MFMailComposeViewController *mailController = theTimer.userInfo;
    UIBarButtonItem *sendBtn = mailController.navigationBar.topItem.rightBarButtonItem;
    id targ = sendBtn.target;
    [targ performSelector:sendBtn.action withObject:sendBtn];
}

【问题讨论】:

  • 这不是MFMailComposeViewController 的预期行为。我不建议这样做,Apple 很可能会拒绝您的应用程序使用这种自动电子邮件方法。
  • 我建议您查看一些后台电子邮件发送代码,例如此处接受的答案:stackoverflow.com/questions/6284599/…

标签: iphone objective-c ios xcode ios4


【解决方案1】:

您需要得到用户的确认。用户将点击发送按钮。您只能创建邮件并显示给用户确认。 MFMailComposeViewController 的默认行为。

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-07
    • 1970-01-01
    • 2021-05-14
    • 2013-08-30
    相关资源
    最近更新 更多