iOS 8 个多个弹出框 - "Warning: Attempt to present * on * which is already presenting (null)"

iOS 8 multiple popovers - "Warning: Attempt to present * on * which is already presenting (null)"

我有两个 UIBarButtonItem,它们都在我的 iOS 8 应用程序中打开一个带有导航控制器的弹出窗口。两者都是使用 storyboards 设置的,类型 Present As Popover 和 "Animates" 设置为 true。 "Anchor"设置为对应的UIBarButtonItem.

在代码中,这是呈现弹出窗口/执行转场之前的配置。

override public func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
   if segue.identifier == SEGUE_ID_ADD_ACTION {
        if let actionViewController = (segue.destinationViewController as! UINavigationController).topViewController as? ActionViewController {
            let newAction = Action()
            actionViewController.selectedAction = newAction
            actionViewController.delegate = self
        }
    }
    else if segue.identifier == SEGUE_ID_FILTER {
        let controller = (segue.destinationViewController as! UINavigationController).topViewController as! FilterViewController
        controller.delegate = self
        controller.setup(filter)
        segue.destinationViewController.popoverPresentationController!.delegate = controller
    }
}

显示的两个视图控制器 类 没有更多的弹出窗口特定代码超过:

let size = CGSizeMake(320, 460)
self.navigationController?.preferredContentSize = size

viewWillAppear

我遇到的问题是,当弹出框 A 出现时,我按下按钮打开弹出框 B。日志中显示错误,但没有任何反应。弹出框 B 最好显示或至少隐藏弹出框 B(类似于单击弹出框外的任何其他地方)。日志中的错误:

 Warning: Attempt to present <UINavigationController: 0x7fbdac027000>  on <xxx.ActionListViewController: 0x7fbdac075000> which is already presenting (null)

正在添加

self.navigationController?.popoverPresentationController?.passthroughViews = nil

在包含 viewcontroller 的弹出窗口中至少已修复,因此当单击导航项中的另一个按钮时确实会触发关闭另一个弹出窗口。