gpt4 book ai didi

objective-c - 使用MFMailComposeViewController发送邮件失败

转载 作者:行者123 更新时间:2023-12-01 18:31:25 34 4
gpt4 key购买 nike

我最近向苹果提交了一个应用,可惜它被拒绝了。给出的原因是它具有无法发送给 friend 的电子邮件功能。 (不用说,但是在我的设备上效果很好)。我正在使用MFMailComposeViewController,填写主题和正文并添加附件。然后,用户必须执行其余的操作才能发送。当我要求详细说明时,审稿人说...

我们随您的应用程序发送的电子邮件列在Gmail中,而Yahoo测试帐户“发件箱”则出现错误,指出无法访问外发邮件服务器。

...应该算作我的应用程式有错误吗?我实际上并不发送邮件,我只是使用内置的SDK调用来准备消息。我知道“是您的设备”这一说法并不能真正促使我批准我的应用,但我确实认为这是他们的设备。

任何人都可以想到导致此类消息的电子邮件失败的任何原因,以及那些原因,我实际上可以做的任何事情?

现在我的代码...

...我在哪里发送消息

- (void)sendMail
{
NSData *vCards = (NSData *)ABPersonCreateVCardRepresentationWithPeople((CFArrayRef)self.selections);

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

[mc setSubject:@"Contact"];

[mc setMessageBody:@"<p>My message...<p>" isHTML:YES];
NSString *label = ([self.selections count] == 1)? (NSString *)ABRecordCopyCompositeName([self.selections objectAtIndex:0]): @"Contacts";

[mc addAttachmentData:vCards mimeType:@"text/x-vcard" fileName:label];

[self presentModalViewController:mc animated:YES];
[mc release];
}

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
switch (result) {
case MFMailComposeResultCancelled:
NSLog(@"Mail send canceled.");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved.");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent.");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail send error: %@.", [error localizedDescription]);
break;
default:
break;
}
[self dismissModalViewControllerAnimated:YES];
}

现在,我了解到如果消息失败,我实际上并没有做任何有用的事情,但是如果消息在撰写级别上失败了,该消息甚至应该到达用户的发件箱吗?

我将提交另一个版本以警告错误详细信息,但我怀疑会有任何错误。

最佳答案

我做过类似的事情,您可以尝试不发送电子名片吗?告诉我是否可行...

关于objective-c - 使用MFMailComposeViewController发送邮件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8436492/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com