Share text with images on Instagram on ios

In my application, I use an image on Instagram. It works well in my application.

I am using the following code.

@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]]; // NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]]; 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; } 

Now I also want to share some text with the image.

As the picture below. In the "Create Signature" section, for example, I want a special text by default. "Share this photo."

How can i do this?

Thanks in advance...

enter image description here

Edited

I open Instagram from my image sharing app and it works great.

But is it possible that I can check whether he shared it successfully or not?

So, I want to perform some action in my database when the user successfully shares the image.

How can i do this?

+7
source share
3 answers

I got my answer. Just added a line and it worked for me.

 self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"]; 

Thanks...

+14
source

It is also documented in official documentation at http://instagram.com/developer/iphone-hooks/

To include a pre-populated caption with your photo, you can set the annotation property in the request for interaction with the NSDictionary document containing NSString under the key "InstagramCaption". Note. This feature will be available on Instagram 2.1 and later.

+3
source

You are no longer allowed to share pre-filled text using Instagram or Facebook.

Only images and screenshots can be used in conjunction with the UIDocumentInteractionController.

+1
source

All Articles