0

我是一名 Objective-C 菜鸟,试图在我的应用程序的 iBooks 库中打开 PDF 文件。

我使用以下代码 - 它似乎创建了打开的对话框,但我收到一个错误 - “无法从没有窗口的视图中呈现弹出框”。我不知道如何纠正这个......我在这里做错了什么?

- (void) showOptionsMenu
{
    NSURL *fileURL = [NSURL fileURLWithPath:@"ibooks://test.pdf"];
    docController = [self setupControllerWithURL:fileURL usingDelegate:self];
    bool didShow = [docController presentOptionsMenuFromBarButtonItem:self.toolbarItems[0] animated:YES];
    if(!didShow)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Sorry, app not found" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
    }   
}
4

1 回答 1

0

通过为我的 UIDocumentInteractionController 声明一个属性来解决问题。

于 2013-04-04T15:43:52.983 回答