Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在ios中与Instagram上的图像共享文本_Iphone_Ios_Objective C_Instagram - Fatal编程技术网

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

Iphone 在ios中与Instagram上的图像共享文本,iphone,ios,objective-c,instagram,Iphone,Ios,Objective C,Instagram,在我的应用程序中,我在Instagram上共享了一张图片。它在我的应用程序中运行良好 我正在使用以下代码 @property (nonatomic, retain) UIDocumentInteractionController *dic; CGRect rect = CGRectMake(0 ,0 , 0, 0); UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);

在我的应用程序中,我在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;
}
@属性(非原子,保留)UIDocumentInteractionController*dic;
CGRect rect=CGRectMake(0,0,0,0);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size,self.view.opaque,0.0);
[self.view.layer renderContext:UIGraphicsGetCurrentContext()];
UIGraphicsSendImageContext();
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://%@”,屏幕截图]];
self.dic.UTI=@“com.instagram.photo”;
self.dic=[self-setupcontrollerwhithurl:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
[self.dic presentOpenMinumeFromRect:rect-inView:self.view动画:是];
-(UIDocumentInteractionController*)setupControllerWithURL:(NSURL*)fileURL usingDelegate:(id)interactionDelegate{
UIDocumentInteractionController*interactionController=[UIDocumentInteractionController interactionControllerWithURL:fileURL];
interactionController.delegate=interactionDelegate;
返回交互控制器;
}
现在我还想与图像共享一些文本

如下图所示。在“写标题”中,我想要一些默认的自定义文本,例如“共享这张照片”

我该怎么做

先谢谢你

已编辑

我正在从我的应用程序中打开Instagram以共享图像,它运行良好

但是我是否可以检查用户是否成功共享了它

表示当用户成功共享图像时,我希望在数据库中执行某些操作


我该怎么做呢?

我得到了答案。只是添加了一行,对我来说很有用

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

谢谢……

它也记录在

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


您不再被允许与Instagram或Facebook共享预填充文本


只有图像/屏幕截图可以通过UIDocumentInteractionController共享

截至2015年8月,Instagram将忽略InstagramOption注释。请参阅:添加文本和图像的任何其他设置。。?