无法将视频发送到MFMessageComposeViewController

时间:2014-05-06 10:29:55

标签: objective-c ios7 xcode5 mfmessagecomposeview

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

enter image description here

0 个答案:

没有答案