问题描述
我有一个应用程序与Instagram共享为iOS5和现在在iOS6中共享,虽然 canOpenURL
返回true并且代码执行,但共享不再有效。图像将以 .igo
扩展名保存到应用程序的文档文件夹中。这将通过com.instagram.exclusivegram传递给Instagram。
I have an app that shares with instagram built for iOS5 and now in iOS6, sharing no longer works although canOpenURL
returns true and code executes. The images are saved to the documents folder of the application with a .igo
extension. This is passed to instagram with com.instagram.exclusivegram.
代码如下,它进入if语句并显示here in但不打开Share With像屏幕底部那样的对话框。
The code is below, it enters the if statement and displays "here in" but does not open the Share With dialog like it used to at the bottom of the screen.
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
正在提供也是正确的文件路径。
_imgToUpload
is providing the correct filepath as well.
谢谢你,
尼克
Thank you,Nick
推荐答案
刚做了一些测试并找到了解决方案。不要出现在keyWindow中。
Just did some testing and found a solution. Do not present in the keyWindow.
[uidController presentOpenInMenuFromRect:navRect inView:self.view animated:YES];
我已对此进行了测试,它将解决问题。
I have tested this and it will fix the problem.
这篇关于UIDocumentInteractionController不再适用于iOS6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!