应用程序构建良好,直到我开始向 Storyboard添加按钮然后我收到上述错误。它在我的 GameViewController 中的这一行代码处停止。
let scnView = self.view as! SCNView
Storyboard本身将其自定义类设置为 GameViewController(没有 SCNView 选项)。 GameViewController 本身继承自 UIViewController。 我正在使用 Xcode7.2。
最佳答案
确保在文件顶部也导入 SceneKit。
import SceneKit
打开“Main.storyboard”文件。选择 ViewController -> View 转到“Identity Inspector”并将 Class 字段更改为 SCNView。 SceneKit Help
关于ios - 无法将类型 'UIView' 的值转换为 'SCNView',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35323147/