Uploading photos to Instagram via your own iOS app

Hipstamatic are one of the few apps that has been given write access via Instagram's API.

Instagram doesn't have a public API for posting photos, it lets you get their data but not write your own.

Hipstamatic and several other apps have negotiated special deals with Instagram that allow them to use the write API and post photos directly.

For all other developers you need to use iOS hooks to share to Instagram by switching to their app.

As far as I know its not easy to get Instagram to allow you write access- you would need to have a top app with high quality content and be friendly with the right people :)


You can not directly post an image on Instagram. You have to redirect your image with UIDocumentInteractionController. Use Below code , Hope It will help

@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;
}

verbatim from the Instagram API documentation:

https://instagram.com/developer/endpoints/media/

At this time, uploading via the API is not possible. We made a conscious choice not to add this for the following reasons:

  1. Instagram is about your life on the go – we hope to encourage photos from within the app.
  2. We want to fight spam & low quality photos. Once we allow uploading from other sources, it's harder to control what comes into the Instagram ecosystem. All this being said, we're working on ways to ensure users have a consistent and high-quality experience on our platform.

What you are trying to do is implemented through the Instagram API http://instagram.com/developer/. You can also use the Instagram App to do some similar actions. These are documented under iPhone Hooks. If you are using Ruby Motion, then you will be able to use the official framework. Unfortunately, there is no officially supported Objective-C iOS API but some open source alternatives are available, like the NRGramKit.

The exact way of implementing the interaction with the Instagram API is beyond a Stack Overflow answer but the links above should give you a good starting point if you are familiar with iOS programming.

Tags:

Ios

Instagram