PresentViewController 故障排除

Posted

技术标签:

【中文标题】PresentViewController 故障排除【英文标题】:PresentViewController Troubleshooting 【发布时间】:2015-06-19 21:50:35 【问题描述】:

在我的 swift 应用程序中,我试图让按钮点击切换视图控制器。这是我正在使用的代码:

presentViewController(pythTheoremViewController.self, animated: true, completion: nil)

这会返回错误“无法使用参数列表类型调用'presentViewController')pythTheoremViewController.Type,动画:Bool,完成:nil)

这是什么意思,我该如何解决?

【问题讨论】:

【参考方案1】:

如果你的 ViewController-instance 是 pythTheoremViewController,删除 self

【讨论】:

【参考方案2】:

抱歉这个愚蠢的问题!当我应该在视图控制器名称后使用 () 时,我使用了自动更正 .self 选项。

【讨论】:

以上是关于PresentViewController 故障排除的主要内容,如果未能解决你的问题,请参考以下文章

生产环境10分钟黄金时间快速排障:CPU不定时飙高怎么排查?

文件服务器满故障排查总结

presentViewController pushViewController和presentModalViewController

presentViewController pushViewController和presentModalViewController

PresentViewController切换界面

找不到 presentViewController