我有一个应用程序,它与为iOS5构建的Instagram共享,现在在iOS6中共享,虽然canOpenURL返回true并且代码执行,但共享不再有效.图像将以.igo扩展名保存到应用程序的文档文件夹中.这是通过com.instagram.exclusivegram传递给Instagram的.
代码如下,它进入if语句并显示"here in"但不会像屏幕底部那样打开Share With对话框.
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");
}
Run Code Online (Sandbox Code Playgroud)
_imgToUpload 也提供了正确的文件路径.
谢谢,尼克