1

我必须通过消息发送视频。我附上了 30KB 大小的视频。但它会提醒“视频太长”。下面我提到了通过消息发送视频的代码。

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

在此处输入图像描述

4

0 回答 0