首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ios中Instagram上的图片文本共享

ios中Instagram上的图片文本共享
EN

Stack Overflow用户
提问于 2013-04-02 10:35:58
回答 3查看 7.1K关注 0票数 8

在我的应用程序中,我在Instagram上分享了一张图片。它在我的应用程序中运行得很好。

我使用以下代码。

代码语言:javascript
运行
复制
@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中执行一些操作。

我该怎么做?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-04-02 11:05:29

我得到了答案。刚加了一句对我有用。

代码语言:javascript
运行
复制
self.dic.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];

谢谢..。

票数 14
EN

Stack Overflow用户

发布于 2013-12-04 15:56:35

它也被记录在http://instagram.com/developer/iphone-hooks/的正式文档中。

若要在照片中包含预填充的标题,可以将文档交互请求上的注释属性设置为包含“NSDictionary”键下的NSString的注释属性。注意:此功能将在Instagram 2.1及更高版本上提供。

票数 3
EN

Stack Overflow用户

发布于 2016-01-02 09:23:13

您不能再与Instagram或Facebook共享预先填充的文本。

只有图片/截图可以通过UIDocumentInteractionController共享。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15761932

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档