UIDocumentInteractionController不再iOS6的
问题描述:
的作品我有与iOS5的,现在在iOS6的内置Instagram的分享,分享不再起作用虽然canOpenURL
返回true,代码执行的应用程序。图像以.igo
的扩展名保存到应用程序的文档文件夹中。这通过com.instagram.exclusivegram传递给instagram。UIDocumentInteractionController不再iOS6的
的代码如下,它进入if语句,并显示“在这里”,但没有打开分享对话框喜欢它在屏幕的底部使用。
NSLog(@"%@", _imgToUpload);
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
uidController = [[UIDocumentInteractionController alloc] init];
//imageToUpload is a file path with .igo file extension
uidController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:_imgToUpload]];
uidController.UTI = @"com.instagram.exclusivegram";
uidController.delegate = self;
CGRect navRect = self.view.frame;
[uidController presentOpenInMenuFromRect:navRect inView:[UIApplication sharedApplication].keyWindow animated:YES];
NSLog(@"here in");
}
_imgToUpload
也提供了正确的文件路径。
谢谢 尼克
答
只是做了一些测试,并找到了解决办法。不要出现在keyWindow中。
[uidController presentOpenInMenuFromRect:navRect inView:self.view animated:YES];
我测试过了,它会解决这个问题。
答
另一个原因uidocumentinteraction控制器iOS6的不工作是,新的动作片/发射面板(它显示了可用来打开该文档的应用程序)现在使用。我的应用程序工作正常启动与iOS5的iBooks失败,因为我从viewDidLoad启动,这是现在太早,我得到当前视图控制器'其视图不在窗口层次结构'的错误,所以我改变了我的代码执行选择器后延迟1秒。该应用程序现在通过新面板调用iBooks。
谢谢,我已经想通了,忘了发布!良好的结果 –
感谢这个作品。但是没有任何方法可以直接进入Instagram,没有“Open In”操作表? – GeneCode