【问题标题】:iBooks opening a PDF - "Popovers cannot be presented from a view which does not have a window"iBooks 打开 PDF -“无法从没有窗口的视图中呈现弹出窗口”
【发布时间】:2013-04-03 16:33:07
【问题描述】:

我是一名 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];
    }   
}

【问题讨论】:

    标签: ios objective-c ipad


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-25
      相关资源
      最近更新 更多