Публикация видео в Instagram с помощью UIDocumentInteractionController

Как поделиться видеофайлом .mp4 в Instagram? Я могу поделиться такими изображениями:

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, как вы публикуете видеофайл?


person soleil    schedule 24.03.2014    source источник
comment
Я дал ответ на эту проблему здесь: stackoverflow.com/questions/20017266/   -  person Nico    schedule 16.05.2014
comment
Недостатком ответа @NicoHämäläinen является то, что вы должны сохранить видео в фотопленку (в ios8 вы можете удалить его после). В остальном отличный ответ.   -  person codrut    schedule 06.05.2015