无法将“UIView"(0x112484eb0)类型的值转换为“SKView"(0x111646718) [英] Could not cast value of type 'UIView' (0x112484eb0) to 'SKView' (0x111646718)

查看:19
本文介绍了无法将“UIView"(0x112484eb0)类型的值转换为“SKView"(0x111646718)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法将UIView"(0x112484eb0)类型的值转换为SKView"(0x111646718).我不断收到此错误.任何人都可以帮助我,因为代码行默认情况下就在那里.我使用 xcode 7 beta 将 SK 游戏转换为最新的 swift 语法.编译器遗漏了很多东西,这就是我回到 xcode 6 的原因.我没有红色错误;但是,游戏崩溃并显示线程 1:signal SIGARBT.关于 swift 2 和 swift 1 最新版本之间变化的任何提示,这些提示可能会导致转换为最新 swift 语法时出现问题.也许一些被转换的东西,我应该在 xcode 6.3.2 中改变.解决此崩溃问题后,我将删除测试版.代码中可能存在错误,因为当我将代码复制到全新的 xcode 项目时,我遇到了同样的错误.提前致谢!

Could not cast value of type 'UIView' (0x112484eb0) to 'SKView' (0x111646718). I keep on getting this error. Can anyone help me because the line of code is there by default. I converted the SK game into the latest swift syntax using the xcode 7 beta. The compiler was missing a lot of things, that is why i came back to xcode 6. I have no red errors; but, the game crashes and says thread 1: signal SIGARBT. Any tips on the changes between swift 2 and the latest version of swift 1 that could have caused problems in the conversion to the latest swift syntax. Perhaps something that was converted, that I should change in xcode 6.3.2. I will delete the beta once this crash issue is resolved. There is probably an error in the code, because i got the same error when i copied the code onto a brand new xcode project. Thanks in advance!

let skView = self.view as! SKView

推荐答案

我终于修好了!我不必将函数放在 GameViewController 中并从游戏场景中调用它们,而是将函数放在 gameScene 中并用 self.view 替换 view!.

I finally fixed it! Instead of putting the functions in the GameViewController and calling them from game scene, I had to put the functions in gameScene and replace view with self.view!.

这篇关于无法将“UIView"(0x112484eb0)类型的值转换为“SKView"(0x111646718)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆