XCode can't find SpriteKit?

This seems to be a pretty weird issue. I'm following along with a SpriteKit tutorial, and while I can build my project and run it on my phone, I keep getting this error in the IDE: Cannot load underlying module for SpriteKit

It says it cannot load the module but that's weird because SpriteKit should be a native framework that must've been installed with my 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.

Here's my system info:
  • XCode version: Version 12.0 (12A7209)

  • MacOS version: MacOS Catalina 10.15.7 (19H2)

Is this a bug in XCode?

Accepted Reply

I did try cleaning the project and it didn't do anything. I had to restart XCode and that fixed the issue. Weird.

Replies

Have you tried "Clean Build Folder"?
What happens if you create a new SpriteKit project and run that, same error?
I did try cleaning the project and it didn't do anything. I had to restart XCode and that fixed the issue. Weird.

I had the same issue. I tried a lot of troubleshooting solutions like:

  • Cleaning the Build folder;
  • Restarting Xcode;
  • Reinstalling Xcode (!);
  • Deleting contents of Xcode's Derived Data folder.

Nothing worked 😕 But I believe I found the solution! ☺️

Here's the fix that worked for me: Simply delete Xcode cached data.

To delete Xcode cached data:

  1. Close Xcode;
  2. Open System Preferences on you Mac;
  3. Go to General tab and select Storage section;
  4. Locate Developer section (the system might take few moments to calculate the size of the files on the drive);
  5. Press on 'i' icon next to Developer section;
  6. Under Xcode Project Build Files locate cache list item (I already deleted it, so I don't remember the original name 😋 )
  7. Delete the cache and wait for the deletion process to complete;
  8. Open Xcode. The error should disappear and everything should work as expected.

This worked for me. Hope this helps!

  • Thank you!!! It helped! 🤗

  • It worked for me, too. Thank you.

Add a Comment