1

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

Muthu Sabarinathan
  • 1,198
  • 2
  • 21
  • 49
Arjun Sa
  • 125
  • 2
  • 13
  • 1
    Isn't that error kind of clear? you can only send smaller video clips through the built-in MFMessageComposeViewController class. Many mail servers won't handle files that are more than a few megs. If you want to send 10 / 20 / 50 / 100 Meg files, maybe you should set up your own web service and upload the videos through there. – Michael Dautermann May 06 '14 at 10:36
  • 1
    possible duplicate of [How to send video file via MMS using MFMessageComposeViewController in ios?](http://stackoverflow.com/questions/23491713/how-to-send-video-file-via-mms-using-mfmessagecomposeviewcontroller-in-ios) – rckoenes May 06 '14 at 11:18

0 Answers0