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