我需要使用Instagram分享图片。我使用this创建了CLIENT ID和CLIENT SECRET。我已经搜索了堆栈溢出但我发现任何有用的链接。任何人都可以帮我解决这个问题。
答案 0 :(得分:2)
是您可以在Instagram上发布图像,如下面的代码
-(IBAction)uploadimage:(UIButton*)sender
{
NSURL *instagramURL = [NSURL URLWithString:@"instagram://"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
CGSize size=CGSizeMake(612, 612);
UIImage *TajImage = [UIImage imageNamed:@"gujarat.jpg"];
UIImage *image = [self scale:TajImage toSize:size];
NSString *jpgPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"instagram.igo"];
[UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPath atomically:YES];
CGRect rect = CGRectMake(0 ,0 , 0, 0);
NSURL *fileURL = [NSURL fileURLWithPath:jpgPath];
self.docFile = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
self.docFile.delegate = self;
[self.docFile setUTI:@"com.instagram.exclusivegram"];
[self.docFile setAnnotation:@{@"InstagramCaption" : @"Gujarti Lion,Girnar,India"}];
[ self.docFile presentOpenInMenuFromRect:rect inView:self.view animated:YES];
[[UIApplication sharedApplication] openURL:instagramURL];
}
}
在Instagram上传图片: