我有一个标识为MoodController
现在我正在使用此代码将其作为弹出框
弹出let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "MoodController")
controller.modalPresentationStyle = UIModalPresentationStyle.popover
controller.popoverPresentationController!.delegate = self
self.present(controller, animated: true, completion: nil)
但我收到此错误
2018-04-01 19:19:58.558208 + 0100 PlanTheDay [14910:215426] ***因未捕获的异常终止应用程序' NSGenericException',原因:' UIPopoverPresentationController()应该有在演示发生之前设置的非零sourceView或barButtonItem。'
我的代码出了什么问题?