Instagram最近改变了他们的API政策,允许开发人员通过他们自己的应用程序将图片发布到Instagram平台.我们之前使用的其他几种技术来做到这一点.其中一个是调用Instagram应用程序,它实际上会打开Instagram并从那里进行共享.有关如何完成此操作的教程可以在这里看到:如何从您自己的iOS应用程序共享图像到Instagram
然而,有几个应用程序允许直接共享到Instagram平台而无需调用Instagram应用程序.Hipstamatic的Oggl允许直接共享到Instagram而无需调用Instagram.下面我发布了一些过程的屏幕截图.
拍完照片后,Oggl给了我其他几个社交网络,我可以分享我的照片.我选择了Facebook和Instagram.

在我选择Instagram后,它打开了Safari,它带我到以下两页授权Oggl发布到Instagram.我输入了我的Instagram凭据,然后它将我带到了授权页面.

一旦我授权Oggl,我就可以上传到Instagram,几秒钟后,我在Instagram新闻Feed中看到了这张照片.这种类型的共享非常类似于Facebook和Twitter共享.它有相同的概念.怎么可以这样做呢?如何在他们的应用程序中复制这个确切的过程?在我的应用程序中拍摄的照片是612像素×612像素,因此它们与Instagram上拍摄的照片尺寸兼容.我已经实现了对Facebook和Twitter的共享,但我想像Oggl那样实现上传到Instagram.这可能吗?
有许多iOS开发人员可以从这个问题的详细规范答案中受益.
谢谢
Row*_*wan 27
Hipstamatic是少数通过Instagram API提供写入权限的应用程序之一.
Instagram没有用于发布照片的公共API,它可以让您获取数据,但不能自己编写.
Hipstamatic和其他几个应用程序已与Instagram达成特殊协议,允许他们使用写API并直接发布照片.
对于所有其他开发人员,您需要使用iOS挂钩通过切换到他们的应用程序来共享到Instagram.
据我所知,让Instagram写入访问权限并不容易 - 你需要拥有一个高质量内容的顶级应用程序,并与合适的人友好:)
小智 9
你不能直接在Instagram上发布图像.您必须使用UIDocumentInteractionController重定向图像.使用下面的代码,希望它会有所帮助
@property (nonatomic, retain) UIDocumentInteractionController *dic;
CGRect rect = CGRectMake(0 ,0 , 0, 0);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndImageContext();
NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.igo"];
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", jpgPath]];
self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
-(UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43920 次 |
| 最近记录: |