使用UIDocumentInteractionController在IOS 9中打开Instagram

使用UIDocumentInteractionController在IOS 9中打开Instagram,ios,instagram,ios9,Ios,Instagram,Ios9,您好,这是我用图片直接打开Instagram应用程序的代码。正如与UIDocumentInteractionController相关的Apple文档和Instagram钩子页中所述,这段代码应该直接用图像打开Instagram,但在所有测试条件下,它会打开操作表,并保存与扩展兼容的所有应用程序 我还将instagram列入了LSApplicationQueriesSchemes的白名单 我怎样才能得到这个结果?这是IOS 9的一个bug还是一个新的安全特性 提前谢谢你的帮助 NSURL *ins

您好,这是我用图片直接打开Instagram应用程序的代码。正如与UIDocumentInteractionController相关的Apple文档和Instagram钩子页中所述,这段代码应该直接用图像打开Instagram,但在所有测试条件下,它会打开操作表,并保存与扩展兼容的所有应用程序

我还将instagram列入了LSApplicationQueriesSchemes的白名单

我怎样才能得到这个结果?这是IOS 9的一个bug还是一个新的安全特性

提前谢谢你的帮助

NSURL *instagramURL = [NSURL URLWithString:@"instagram:/"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.ig"];
[UIImagePNGRepresentation(capturedImage) writeToFile:getImagePath atomically:YES];
NSURL *imageFileURL =[NSURL fileURLWithPath:getImagePath];
NSLog(@"imag %@",imageFileURL);

self.dic.delegate = self;
self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:imageFileURL usingDelegate:self];
[self.dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

} else  //prompt for app missing


- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL
                                           usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate { 
UIDocumentInteractionController *interactionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
NSURL*instagramURL=[NSURL URLWithString:@“instagram:/”;
if([[UIApplication sharedApplication]canOpenURL:instagramURL])
{
NSArray*Path=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,是);
NSString*documentsDirectory=[paths objectAtIndex:0];
NSString*getImagePath=[DocumentsDirectoryStringByAppendingPathComponent:@“savedImage.ig”];
[UIImagePNGRepresentation(capturedImage)WriteFile:getImagePath原子性:是];
NSURL*imageFileURL=[NSURL fileURLWithPath:getImagePath];
NSLog(@“imag%@”,imageFileURL);
self.dic.delegate=self;
self.dic.UTI=@“com.instagram.photo”;
self.dic=[self-setupcontrollerwhithurl:imageFileURL usingDelegate:self];
[self.dic presentOpenMinumeFromRect:CGRectZero-inView:self.view-animated:YES];
}else//缺少应用程序提示
-(UIDocumentInteractionController*)setupControllerWithURL:(NSURL*)文件URL
usingDelegate:(id)interactionDelegate{
UIDocumentInteractionController*interactionController=
[UIDocumentInteractionController interactionControllerWithURL:fileURL];
interactionController.delegate=interactionDelegate;
返回交互控制器;
}

如果将图像另存为
.igo
我在操作表中看到的唯一应用是“Instagram”、“Notes”和“other”

编辑:我还没有找到一种直接用图片打开Instagram的方法,似乎只能用图片直接打开Instagram

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    [[UIApplication sharedApplication] openURL:instagramURL];
}
但是你不能用它来添加图像


编辑2:我忘了在.igo格式中添加您需要使用的
self.dic.UTI=“com.instagram.exclusivegram”

一些相关问题报告了相同的问题,唯一的希望是苹果纠正这种行为。。