问题描述
我希望我的应用能够将视频上传到 Instagram.
I want my app to be able to upload videos to instagram.
Instagram iPhone Hooks 提供了如何使用 iPhone Hooks 的信息将照片上传到 Instagram.我的问题是是否有人有任何关于如何完成相同但视频的经验?
Instagram IPhone Hooks gives information how to use the iphone hooks to upload a photo to instagram. My question is if anyone has any experience on how to accomplish the same but for a video?
推荐答案
Instagram 的 API 不直接支持从 3rd 方应用程序上传任何内容.因此,在向用户提供功能时,您必须做出一些丑陋的用户体验妥协.
Instagram's API doesn't directly support uploading anything from 3rd party applications. Therefore you have to do some ugly user experience compromises when providing the functionality to your users.
首先,准备好要上传到 Instagram 的视频并将其路径存储在某处
First, Prepare the video you want to upload to Instagram and store the path to it somewhere
其次,将其保存到用户的相机胶卷:
Second, Save it to the user's Camera Roll:
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(filePath)) {
UISaveVideoAtPathToSavedPhotosAlbum(filePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
}
第三,现在视频已保存,告诉用户为了将视频上传到他们的 Instagram,他们必须在点击上传按钮后从他们的相机胶卷中选择它.
Third, now that the video is saved, tell the user that in order to upload the video to their Instagram, they must select it from their camera roll after clicking the upload button.
上传按钮只会执行以下操作:
The upload button would simply do the following:
NSURL *instagramURL = [NSURL URLWithString:@"instagram://camera"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
Instagram API 不支持通过任何用于上传目的的 API 端点的即时媒体选择,这是非常愚蠢的,但就目前而言,这是唯一的方法.
It's very silly that the Instagram API doesn't support immediate media selection through any of the API endpoints for upload purposes, but as it stands right now, this is the only way.
这篇关于使用钩子在 Instagram 上发布视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!