Instagram recently made a change to their API policy which allowed developers to post pictures to the Instagram platform via their own app. Several other techniques we're previously employed to do this. One of them was to invoke the Instagram application which would essentially open up Instagram and do the sharing from there. A tutorial on how this can be done can be seen here: How to share image to Instagram from your own iOS app
However there are several applications out there that allow for direct sharing to the Instagram platform without invoking the Instagram application. Hipstamatic's Oggl allows for direct sharing to Instagram without invoking Instagram. Below I have posted some screen shots of the process.
Once my picture was taken, Oggl gave me several other social networks to which I could share my photo to. I've selected Facebook and Instagram.
After I selected Instagram, it opened up Safari and it brought me to the following two pages to authorize Oggl to post to Instagram. I entered in my Instagram credentials and then it brought me to the authorization page.
Once I authorized Oggl, I was able to upload to Instagram and within seconds, I saw the photo on my Instagram news feed. This type of sharing is very analogous to Facebook and Twitter sharing. It has the same concept. How can one go about doing this? How can one replicate this exact process in their app? The pictures taken in my application are 612px by 612 px, so they are compatible with the dimensions for photos taken on Instagram. I've already implemented sharing to Facebook and Twitter but I would like to implement uploading to Instagram just like how Oggl did. Is this possible?
There are many iOS developers out there who can benefit from a well detailed canonical answer to this question.
Thank You
Instagram app for iPhoneAt the top, tap then tap Post: To upload a photo from your phone's library, select the photo you'd like to share. To take a new photo, tap . You can tap to switch between front and rear-facing cameras and to adjust flash.
Instagram users rejoice: you can now share photos and videos directly to the service from any other app that supports share extensions.
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;
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With