【发布时间】:2013-08-08 03:03:01
【问题描述】:
我正在尝试在我的应用上显示UIDocumentInteractionController。在 iPhone 上一切正常,但在 iPad 上却什么也没有。这是我的代码:
interactionController = [UIDocumentInteractionController interactionControllerWithURL:imageFile];
interactionController.UTI = @"com.instagram.photo";
interactionController.annotation = [NSDictionary dictionaryWithObject:[self commentForInstagram] forKey:@"InstagramCaption"];
[interactionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
interactionController 是对实例的强引用,imageFile 存在。在 iPhone 上,它会弹出“打开方式...”对话框,并且 Instagram 存在。在 iPad 上,上述代码运行时绝对没有任何反应。是的,我确实安装了 Instagram,并且可以在我的 iPad 上使用。
执行代码时什么都没有发生的原因可能是什么? self.view 和 self.view.frame 是有效对象(在调试时测试)。
谢谢,坎。
【问题讨论】:
-
调用
presentOpenInMenuFromRect:inView:animated:的返回值是多少?您确定imageFile不是nil并且是指向图像文件的有效文件 URL? -
正如我在问题中明确指出的那样, imageFile 存在。问题似乎源于目前的方法以及它在 iPhone 和 iPad 上的行为方式有何不同。如果我传入一个自定义矩形,并将 self.view.windows 作为视图,它似乎确实有效。
标签: ios ipad ios6 uidocumentinteraction