问题
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