Can't send Video to MFMessageComposeViewContro

2019-03-05 00:25发布

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];

enter image description here

0条回答
登录 后发表回答