如何在iOS设备中将文字/照片/视频分享到Instagram

6

我想分享文本/照片/视频到Instagram上。我已经搜索了很长一段时间,但是没有找到任何合适的文档。如果有人知道如何在Instagram上分享,请告诉我。


使用以下代码,您可以发布照片,但此代码将打开相机,然后从您的应用程序上传所拍摄的照片到Instagram。NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { [[UIApplication sharedApplication] openURL:instagramURL]; } - Nirzar Gandhi
2个回答

2

Instagram媒体终端

目前API不支持上传。我们有意选择不添加此功能,其原因如下:

Instagram是关于你的生活,我们希望鼓励用户在应用内拍摄照片。但是,将来我们可能会根据情况向某些应用程序提供白名单访问权限。

我们想要打击垃圾邮件和低质量照片。一旦我们允许从其他来源上传,就更难控制进入Instagram生态系统的内容。尽管如此,我们正在努力寻找方法,确保用户在我们的平台上获得一致且高质量的体验。

您可以尝试使用以下链接:http://instagram.com/developer/iphone-hooks/https://instagram.com/developer/mobile-sharing/android-intents/


0

请尝试以下代码。

@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]];
//    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];

self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
[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;
}

这对我有效,希望它也能帮到你。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接