1

I am developing an app which needs to post an image to Instagram. I followed these link1 and link2

However, that didn't work for me. After that, I found this link: How to share an image on Instagram in iOS?

I made the changes according to this, but it's not posting the image. Here is my code:

CGRect rect = CGRectMake(0 ,0 , 100, 100);

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIGraphicsEndImageContext();

NSString *staticPath = [[NSBundle mainBundle] pathForResource:@"JB" ofType:@"igo"];
NSString *path_font = [staticPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *fileAppend = [[NSString alloc] initWithFormat:@"file://"];
path_font = [[NSString alloc] initWithFormat:@"%@%@", fileAppend, path_font];

NSLog(@"path_font----%@",path_font);
NSLog(@"filepath_static image----%@",filepath_static);

NSURL *igImageHookFile = [[NSURL alloc] initWithString:path_font];

NSLog(@"igImageHookFile url is---%@",igImageHookFile);

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 ];

Any advice will be really appreciated.

Community
  • 1
  • 1
SAHIL
  • 431
  • 6
  • 18
  • 1
    "But did'nt worked for me" doesn't help us to help you. Using the API hooks is the recommended way to post images using the Instagram app. If it isn't working you are better off saying how you tried to do it and what went wrong rather than jumping around using different methods and asking about how to debug them. – Abizern Nov 20 '12 at 13:30

1 Answers1

1

https://github.com/coryalder/DMActivityInstagram does in fact give a really nice example of posting images to instagram via a UIActivity Control, but you can of course only use the posting part.

Hope that helps.

Community
  • 1
  • 1
Finn Gaida
  • 4,000
  • 4
  • 20
  • 30