我必须通过消息发送视频。我附加了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];