Can't send Video to MFMessageComposeViewController

故事扮演 提交于 2019-12-11 17:54:42

问题


I have to send Video through message. I attached 30KB size of video. But it alerts "Video is too long". Below i mentioned the code to send video through message.

NSString *message = [NSString stringWithFormat:@"Download this Video!"];
MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
messageController.messageComposeDelegate = self;
[messageController setBody:message];

if ([MFMessageComposeViewController canSendAttachments]) {
    NSLog(@"Attachments Can Be Sent.");
     NSString *filePath=[mURL absoluteString];
    NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:filePath]];
    BOOL didAttachVideo = [messageController addAttachmentData:videoData typeIdentifier:@"public.movie" filename:filePath];

    if (didAttachVideo) {
        NSLog(@"Video Attached.");

    } else {
        NSLog(@"Video Could Not Be Attached.");
    }
}

[self presentViewController:messageController animated:YES completion:nil];

来源:https://stackoverflow.com/questions/23491713/how-to-send-video-file-via-mms-using-mfmessagecomposeviewcontroller-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!