ios发邮件 - ios9.3上面使用苹果自带的发邮件类库,发送邮件到企业邮箱结果失败了
怪我咯
怪我咯 2017-04-17 17:51:32
0
2
632

我用这段代码在ios8上面能正常发送邮件到企业邮箱,但是到了ios9上面邮件就发送失败了,是不是用在ios9上面发邮件还需要什么设置丫

    MFMailComposeViewController *mailPickerVc = [[MFMailComposeViewController alloc] init];
    mailPickerVc.mailComposeDelegate = self;
    [mailPickerVc setSubject:PROJECT_NAME];//邮件主题
    [mailPickerVc setToRecipients:@[EMAIL_AUTHOR_ADRESS]];//设置收件人
    [mailPickerVc setMessageBody:@"管理驾驶舱 : \n" isHTML:NO];
    UIImage *image = _cutScreenBgView.saveImage;
    NSData *imageData = UIImagePNGRepresentation(image);
    [mailPickerVc addAttachmentData:imageData mimeType:@"" fileName:@"管理驾驶舱.png"];
    [self presentViewController:mailPickerVc animated:YES completion:nil];
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    NSString *message;
    switch (result) {
        case MFMailComposeResultCancelled:message = @"取消编辑邮件";
            break;
        case MFMailComposeResultSaved: message = @"保存邮件";
            break;
        case MFMailComposeResultSent:message = @"发送邮件";
            break;
        case MFMailComposeResultFailed:message = @"保存邮件/发送邮件失败";
            break;
        default:
            break;
    }
    [UIAlertView showMsgWithTitle:@"发邮件" msg:message confirm:@"确定" cancel:nil blocks:^(NSInteger index) {
        if (index == 0) {//确定
            [TAPublicUtilitiy judjeIsTimeOutSessionAndUpdateActivieSessionTimeCompletion:^(BOOL isShow) {
                if (isShow) {
                    //展示登录页面
                    [self presentViewController:[TAPublicUtilitiy showLoginVc] animated:NO completion:nil];
                } else {
                    [_cutScreenBgView removeFromSuperview];
                    _cutScreenBgView = nil;
                    [self dismissViewControllerAnimated:YES completion:nil];
                }
            }];
        }
    }];
}
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
迷茫

An email account needs to be set up.

刘奇

Can you print the error of - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(nullable NSError *)
?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!