Instagram最近改变了他们的API政策,允许开发者通过自己的应用程序将图片发布到Instagram平台上。我们以前使用过的其他几种技术就是这样做的。其中之一是调用Instagram应用程序,该应用程序本质上是打开Instagram并从那里进行共享。关于如何做到这一点的教程可以在这里看到:如何从你自己的iOS应用分享图片到Instagram
但是,有几个应用程序允许直接共享Instagram平台,而无需调用Instagram应用程序。希普斯塔马蒂Oggl允许直接共享Instagram,而无需调用Instagram。下面我发布了一些程序的屏幕截图。
一旦我的照片被拍摄,Oggl给了我其他几个社交网络,我可以分享我的照片。我选择了Facebook和Instagram。

在我选择Instagram之后,它打开了Safari,并将我带到下面的两个页面,授权Oggl将其发布到Instagram。我输入了我的Instagram凭证,然后它把我带到了授权页面。


一旦我授权Oggl,我就可以上传到Instagram,几秒钟之内,我就在Instagram上看到了这张照片。这种类型的共享非常类似于Facebook和Twitter共享。它有着同样的概念。如何才能做到这一点?如何在他们的应用程序中复制这个精确的过程?在我的应用程序中拍摄的图片是 612 px和612 px,所以它们与Instagram上的照片尺寸是兼容的。我已经实现了分享到Facebook和Twitter,但我想实现上传到Instagram,就像Oggl一样。这个是可能的吗?
有许多iOS开发人员可以从这个问题的详细规范回答中获益。
谢谢
发布于 2013-11-25 23:15:30
Hipstamatic是通过Instagram的API获得写访问权限的为数不多的应用程序之一。
Instagram没有发布照片的公共API,它允许您获取它们的数据,但不需要编写自己的数据。
Hipstamatic和其他几个应用与Instagram达成了特别协议,允许他们直接使用写API和发布照片。
对于所有其他开发人员,您需要使用iOS钩子通过切换到他们的应用程序来与Instagram共享。
据我所知,要想让Instagram允许您访问Instagram并不容易--您需要拥有一个具有高质量内容的顶级应用程序,并且与合适的人友好:)
发布于 2015-04-21 14:08:51
您不能直接在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;
}https://stackoverflow.com/questions/18242610
复制相似问题