2

I'm trying to run SceneKit in Xcode, but when I connect my physical device (iPhone 11) the import of SceneKit fails and the following error occurs: "Cannot load underlying module for 'SceneKit'". Can anybody give me a hint how to fix that? Import of UIKit and ARKit seems to work normally, and even SceneKit before connection to physical device worked.

  • HW: MacBook Air M1 2020

  • OS: macOS Ventura Version 13.3.1 (a) (22E772610a)

  • Xcode: Version 14.3 (14E222b)

connected with

  • iPhone 11

  • iOS-Version: 16.4.1 (a)

Already tried to reset the path to command-line tools via sudo xcode-select --reset and sudo xcode-select -switch /Library/Developer/CommandLineTools and also tried to delete all files in "DerivedData" but even after restart and rebuild no progress.

Thanks!

powloon
  • 21
  • 2
  • Looks like you're using SceneKit with CocoaPods, right? – Andy Jazz May 15 '23 at 21:20
  • 1
    I installed CocoaPods for another project, but I'm not using it in the specific AR project with SceneKit. Does the CocoaPods-installation in the backgrund cause conflicts with SceneKit? How can I figure it out? – powloon May 16 '23 at 18:58
  • It's hard to say. For the purity of the experiment, try creating a SceneKit project on another computer, and then install CocoaPods. If the effect will be the same, then the problem is in the pods. – Andy Jazz May 16 '23 at 19:03
  • See this question: https://stackoverflow.com/questions/42497003/getting-error-cannot-load-underlying-module-when-importing-swift-framework/76399418#76399418 – J Kasparian Jun 04 '23 at 08:04

2 Answers2

2

I had the same issue with SpriteKit module. 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. You're good to go!

This worked for me.

HangarRash
  • 7,314
  • 5
  • 5
  • 32
0

I fixed this issue by deleting Derived Data.

  1. Xcode -> Settings
  2. Press arrow button near Derived Data -> it will open folder where Derived Data is located
  3. Close Xcode
  4. Remove all files in Derived Data folder

That's it!

Xcode -> Settings

HangarRash
  • 7,314
  • 5
  • 5
  • 32
Ilya Biltuev
  • 166
  • 1
  • 7
  • The question specifically states that they tried to delete derived data and it didn't help. So this answer doesn't solve the issue in the question. – HangarRash Jul 04 '23 at 18:46