在我的应用程序中,我在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;
}现在,我也想与图片分享一些文本。
如下图所示。在“写一个标题”中,我想要一些默认的自定义文本。“分享这张照片”
我该怎么做?
提前谢谢..。

编辑的
我从我的应用程序中打开Instagram来分享图片,它运行得很好。
但是,我是否可以检查用户是否已经成功地共享了它?
这意味着当用户成功共享图像时,我希望在我的DB中执行一些操作。
我该怎么做?
发布于 2013-04-02 11:05:29
我得到了答案。刚加了一句对我有用。
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];谢谢..。
发布于 2013-12-04 15:56:35
它也被记录在http://instagram.com/developer/iphone-hooks/的正式文档中。
若要在照片中包含预填充的标题,可以将文档交互请求上的注释属性设置为包含“NSDictionary”键下的NSString的注释属性。注意:此功能将在Instagram 2.1及更高版本上提供。
发布于 2016-01-02 09:23:13
您不能再与Instagram或Facebook共享预先填充的文本。
只有图片/截图可以通过UIDocumentInteractionController共享。
https://stackoverflow.com/questions/15761932
复制相似问题