使用UIDocumentInteractionController将视频分享到Instagram

时间:2014-03-24 23:26:31

标签: ios instagram uiapplication uidocumentinteraction

你如何与Instagram分享.mp4视频文件?我可以分享这样的图像:

NSString* filename = [NSString stringWithFormat:@"testImage.igo"];
        NSString* savePath = [imagesPath stringByAppendingPathComponent:filename];
        [UIImagePNGRepresentation(myImage) writeToFile:savePath atomically:YES];

        NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];

        if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
        {
            self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
            self.documentInteractionController.UTI = @"com.instagram.exclusivegram";
            self.documentInteractionController.delegate = self;
            [self.documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
        }

但这仅适用于图像。我尝试将视频重命名为testVideo.igo,但这只会产生一个空白视频。如果Instagram要求文件有.igo扩展名,你如何发布视频文件?

0 个答案:

没有答案