gpt4 book ai didi

iPhone SDK 电子邮件视频

转载 作者:行者123 更新时间:2023-12-03 20:42:02 25 4
gpt4 key购买 nike

Possible Duplicate:
Can’t send email with video/audio attachment on iphone!

所以在过去的几天里我一直在尝试通过电子邮件发送视频。我成功选择了视频,但我不知道如何将其放入电子邮件中。谢谢。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:NO completion:NULL];
NSURL *mediaUrl = [info objectForKey:UIImagePickerControllerMediaURL];

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





if ([MFMailComposeViewController canSendMail]){

[mailcomposer setToRecipients:[NSArray arrayWithObjects:@"random@random.com", nil]];
[mailcomposer setSubject:@""];
[mailcomposer setMessageBody:@"" isHTML:NO];
[mailcomposer addAttachmentData:mediaUrl mimeType:@"video/mp4" fileName:@"Video"];
[self presentViewController:mailcomposer animated:YES completion:NULL];

}


}

最佳答案

您要将 URL 添加为附件,您需要通过将该 URL 转换为数据来附加 NSData,如下所示

NSData *videoData = [NSData dataWithContentsOfURL:mediaUrl];

然后

[mailcomposer addAttachmentData:videoData mimeType:@"video/mp4" fileName:@"Video"];

关于iPhone SDK 电子邮件视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13103193/

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