Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The document “SceneKit Scene.scn” could not be saved

Tags:

xcode

scenekit

I'm trying to create a SceneKit scene. I can create it, and edit it, but the moment I try to save it I get the error "The document “SceneKit Scene.scn” could not be saved.".

The document “SceneKit Scene.scn” could not be saved.

  • Affects every .scn I try to create, regardless of project (including brand new projects with no changes other than adding this .scn), and does so regardless of what changes (if any) I've made to the Scene (even no changes at all gives this message)
  • When I locate the file in Finder, neither the file nor the folder it's in are locked
  • Project is on main disk
  • Automatic saves also fail with the same error message
  • .scn file can be opened separately to the project, but again, it cannot be saved
  • Neither the default file name nor custom file names help, regardless of whether I change the name in the sidebar after the file is created or at creation time in the New File dialog box
  • Deleting the reference and re-adding the file doesn't help
  • Making a copy of the file, deleing the original (in Xcode), and re-adding the copy doesn't help
  • Cleaning the build folder doesn't help
  • Restarting Xcode doesn't help
  • Rebooting the mac doesn't help
  • Issue only affects .scn files as far as I can see (definitely doesn't affect .swift, .storyboard or .metal files)
  • Affects Xcode 10.0, macOS 10.14 (18A391) (Also affected previous version of macOS, but I can no longer remember which version that was)
  • Affects Xcode 10.1, macOS 10.14.1 (18B75)
  • Affects Xcode 10.2, macOS 10.14.4 (18E226) even worse, as it insists on saving before closing the project, but can't save, so I can only close the project or Xcode by force-quitting.
  • Affects Xcode 10.2.1, macOS 10.14.4 (without the bug from 10.2)
  • Affects Xcode 11.3.1, macOS 10.14.6
  • All my files are in my home directory hierarchy
  • Moving project folder to a different subfolder of my home directory (from ~/Documents/ to ~/Desktop/ or to ~/Downloads) has no effect
  • All files have the same user/group, both those I can write to and the .scn I can't write to
  • My user account is in the same group as the files (ls -l shows staff, as does Preferences.app > Users & Groups > [right click on my account] > Advanced Options… > Group:)
  • Exporting the .scn file (File > Export... ) and adding it to the project again doesn't help
  • It's only Xcode which has a problem saving this file: if I open it in TextWrangler, I can modify and save it without error. Saving it in TextWrangler did not make it saveable in Xcode.
  • Resetting user permissions (diskutil resetUserPermissions / `id -u` as suggested by @JeremyP) didn't help.
  • The project is set to use git, and it doesn't help to commit, pull, or push

Why is Xcode failing to save .scn, all the .scn, and nothing but the .scn?

like image 679
BenRW Avatar asked Oct 14 '18 18:10

BenRW


2 Answers

Had the same issue with .scn files and Xcode 10. I solved it exporting the .scn file (File > Export... ) and adding it to the project again. Not a great solution but it works.

like image 42
Silvi Avatar answered Sep 28 '22 21:09

Silvi


I had the same issue. Changing permissions did not work. Changing the group did not work. Exporting the scene did not work. In the end I tried the solution suggested here:

https://support.apple.com/en-us/HT203538

Actually, I skipped all the way to step 7 and I haven't done steps 8 and 9 yet, but this fixed the issue for me:

diskutil resetUserPermissions / `id -u`

Just run the above in a terminal session. Note that I am logged in as an admin user. That might make a difference.

like image 101
JeremyP Avatar answered Sep 28 '22 22:09

JeremyP