Share your Instagram photo from my iOS app

I was looking for a way to post a photo on Instagram from the iOS app I am developing. But, seeing some links, it seems that they do not support write access using their API. In this way,

  • Can I share photos with Instagram from iOS using the Instagram API or API?
  • If possible, can someone offer me a tutorial or documentation for this?

Their api says that ...

β€œAt the moment, downloading via the API is not possible. We made a conscious choice not to add this for the following reasons:

Instagram - about your life on the go - we hope to encourage photos from the app. However, in the future we may provide access to individual applications in each case. We want to fight spam and low quality photos. Once we allow downloads from other sources, it’s more difficult to control what is part of the Instagram ecosystem. All this suggests that we are working to provide users with a consistent and high-quality experience on our platform. "

That is why I am looking for the best deal.

Thanks in advance for your help.

+3
ios objective-c sharing instagram
Nov 30 '13 at 6:04 on
source share
1 answer

Please try this code on your device .... sharing does not work in Simulator

It will save the image from the application to the document directory, and it will use the same image for instagram.

For sharing I will take only .igo format

-(void)shareInInstagram { NSData *imageData = UIImagePNGRepresentation(imge); //convert image into .png format. NSFileManager *fileManager = [NSFileManager defaultManager];//create instance of NSFileManager NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //create an array and store result of our search for the documents directory in it NSString *documentsDirectory = [paths objectAtIndex:0]; //create NSString object, that holds our exact path to the documents directory NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"insta.igo"]]; //add our image to the path [fileManager createFileAtPath:fullPath contents:imageData attributes:nil]; //finally save the path (image) NSLog(@"image saved"); CGRect rect = CGRectMake(0 ,0 , 0, 0); UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIGraphicsEndImageContext(); NSString *fileNameToSave = [NSString stringWithFormat:@"Documents/insta.igo"]; NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:fileNameToSave]; NSLog(@"jpg path %@",jpgPath); NSString *newJpgPath = [NSString stringWithFormat:@"file://%@",jpgPath]; //[[NSString alloc] initWithFormat:@"file://%@", jpgPath] ]; NSLog(@"with File path %@",newJpgPath); NSURL *igImageHookFile = [[NSURL alloc] initFileURLWithPath:newJpgPath]; NSLog(@"url Path %@",igImageHookFile); self.dic.UTI = @"com.instagram.exclusivegram"; 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 { NSLog(@"file url %@",fileURL); UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL]; interactionController.delegate = interactionDelegate; return interactionController; } 
+11
Apr 03 '14 at 12:10
source share



All Articles