问题描述
我的UIDocumentsInteractionController工作到提出一个动作表与一个按钮,说iBooks,但当我点击该按钮,它只是消除,它不会把我带到iBooks。这是我的代码:
My UIDocumentsInteractionController is working as far as presenting an action sheet with a button that says "iBooks" but when I click on that button, it just dismisses and it doesn't take me to iBooks. Here's my code:
NSString *filenamePath =[NSString stringWithFormat:@"temp.%@", [[file path] pathExtension]];
NSString *docDir = [DataCenter getDocumentsDirectoryPath];
NSString *fullPath = [docDir stringByAppendingPathComponent:filenamePath];
NSURL *url = [NSURL fileURLWithPath:fullPath];
UIDocumentInteractionController *c = [UIDocumentInteractionController interactionControllerWithURL:url];
BOOL success = [c presentOpenInMenuFromBarButtonItem:buttonBack animated:YES];
我做错了什么?
感谢
What am I doing wrong?Thanks
推荐答案
对于那些困扰你的人:你不需要将自己设置为UIDocumentInteractionController的委托。
For those stuck at this: You don't need to set yourself up as UIDocumentInteractionController's delegate at all.
问题是 [UIDocumentInteractionControllerinteractionControllerWithURL:url]
正在自动释放。它认为它将被显示的操作表内部保留,但显然不是。
所以,要保留它,直到行动表驳回。
Problem was [UIDocumentInteractionController interactionControllerWithURL:url]
is being autoreleased. It thought it would be retained internally by the action sheet being shown but apparently it's not.So yea, gotta retain it until action sheet dismisses.
这篇关于UIDocumentsInteractionController显示iBooks,但不打开它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!