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

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

问题描述

无法将'UIView'(0x112484eb0)类型的值转换为'SKView'(0x111646718)。我继续得到这个错误。任何人都可以帮助我,因为默认情况下代码行是存在的。我使用xcode 7 beta将SK游戏转换为最新的swift语法。编译器遗漏了很多东西,这就是我回到xcode 6的原因。我没有红色错误;但是,游戏崩溃并说线程1:信号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替换视图!

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天全站免登陆