简体   繁体   English

Xcode 找不到 SpriteKit?

[英]Xcode can't find SpriteKit?

This seems to be a pretty weird issue.这似乎是一个非常奇怪的问题。 I'm following along with this tutorial , and while I can build my project and run it on my phone, I keep getting this error in the IDE:我正在关注本教程,虽然我可以构建我的项目并在我的手机上运行它,但我在 IDE 中不断收到此错误: 显示错误的 IDE 图片

Cannot load underlying module for 'SpriteKit'无法加载“SpriteKit”的底层模块

It says it cannot load the module for SpriteKit but that's weird because SpriteKit should be a native framework that must've been installed with my Xcode .它说它无法加载SpriteKit的模块,但这很奇怪,因为 SpriteKit 应该是一个本机框架,它必须与我的Xcode安装。

It is pretty annoying because Xcode is not context-aware, and code completion doesn't work for any object that's derived from SpriteKit .这很烦人,因为Xcode不是上下文感知的,并且代码完成不适用于从SpriteKit派生的任何对象。

Here's my system info:这是我的系统信息:

  • Xcode version: Version 12.0 (12A7209) Xcode版本: Version 12.0 (12A7209)
  • MacOS version: MacOS Catalina 10.15.7 (19H2) MacOS版本: MacOS Catalina 10.15.7 (19H2)

Is this a bug in Xcode ?这是Xcode的错误吗?

How to solve 95% of "very strange" bugs:如何解决 95% 的“非常奇怪”的错误:

  1. Rebuild.重建。
  2. Close out Xcode and reopen.关闭 Xcode 并重新打开。

I'm not sure exactly why it's not working in your situation, but you might try re-creating the project this way:我不确定为什么它在您的情况下不起作用,但您可以尝试以这种方式重新创建项目:

From the Xcode top menu, select File > New > Project .从 Xcode 顶部菜单中,选择File > New > Project Then in the screen that appears, make sure you select iOS from the tab bar and then select Game .然后在出现的屏幕中,确保从选项卡栏中选择iOS ,然后选择Game

在此处输入图片说明

Click Next and when filling out the options in the next screen, make sure to select SpriteKit for the Game Technology option.单击下一步,在下一个屏幕中填写选项时,确保为游戏技术选项选择SpriteKit

在此处输入图片说明

Once the new project is created, you can copy & paste any missing parts of your code into the appropriate code files in the new project.创建新项目后,您可以将代码的任何缺失部分复制并粘贴到新项目中的相应代码文件中。 That is the "proper" way to create a new game project with SpriteKit.这是使用 SpriteKit 创建新游戏项目的“正确”方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM