在ios上与Instagram上的图像共享文本

Man*_*han 8 iphone objective-c ios instagram

在我的应用程序中,我在Instagram上分享图像.它在我的应用程序中运行良好.

我使用以下代码.

@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;
}
Run Code Online (Sandbox Code Playgroud)

现在我还想与图像分享一些文字.

如下图所示.在"写一个标题"中,我想要一些默认的自定义文本,例如."分享这张照片".

我怎样才能做到这一点?

提前致谢...

在此输入图像描述

编辑

我从我的应用程序中打开Instagram以共享图像,它工作正常.

但我是否可以检查用户是否已成功共享?

意味着我想在用户成功共享图像时在我的数据库中执行某些操作.

我怎样才能做到这一点?

Man*_*han 14

我得到了答案.刚添加了一行,它对我有用.

self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
Run Code Online (Sandbox Code Playgroud)

谢谢...