开发者

xcode The document "..." could not be saved

I use xcode 3.2.4 on snow leopard. Today when I tried to save a file on my project I get an error message saying: The document "nameOfFile.m" could not be saved. I tried reinstalling xcode but no luck. The file can be edited with other editors and I see the same behavior on all my project开发者_JS百科s as well as newly created projects. Any ideas?

xcode The document "..." could not be saved


Simply by rebooting the computer the issue was fixed.


We were having this problem in a lab environment where user files are mounted via NFS. The client machines are running OS X 10.6.7 and the file server is running Debian Linux. After much grief and reading /var/log/syslog on the client machine I discovered it was a subtle file locking / race condition issue with the file system. Evidently, when editing files in a "bundle" (e.g. as in an Xcode project), the OS is using some form of "safe writes" which involves writing transient data atomically to ~/Library/Caches/TemporaryItems/ (which of course is on the NFS mounted system) -- there is a race here that requires proper file locking. We hope we have fixed the problem by changing the nfs_mount options as described in Mounting NFS volumes in OS X


Not sure why but the temp files ended in a odd state. In "/private/var/folders" I simply removed all the folders and it cleared up the problem

cd /private/var/folders

sudo rm -fR *

Note: never do a "sudo rm" unless you really know what you are doing. It can cause irrecoverable damage


I restarted XCode (by a force-quit, not just closing it) and that fixed it for me.


Make sure you have you mouse focused on the code area and not the file in the file list.


Cleaning the project (Product > Clean), then force quitting Xcode (Command + Option + Escape, select Xcode, click Force Quit) solved the issue for me. I'm not sure if the clean was necessary, but that was what I did. Upon re-opening the project, I let Xcode index the project before doing anything, then did a Build, and all is well.


Force quiting Xcode for me worked. I would recommend the same.


Hey........... even i faced the same problem..... But got the answer...... steps:

  1. reveal in folder the project.
  2. select the file that is locked
  3. select 'GEt Info'
  4. deselect ie uncheck the label 'LOCKED' in the Info.


I just ran into the same problem, then I noticed I ran out of disk space. You can disable the warning that pops up when you run low on disk space (perhaps not a wise thing to do). I did that a few days ago and was puzzled for a moment when this message appeared. They could've just said "Disk full" or something instead of "cannot save". Anyway if anyone ever runs into this just free up some disk space.

You might be able to save in an external editor because its not also building your app which might use up the little remaining space. It might also be why it worked after rebooting (if OS X cleaned up some cached stuff on reboot) so it seems plausible.

Either that or your HDD might have just crashed. tic....tic....tic.....


In my Case, the File which was saying document could not be saved was basically Shortcut/Allies of the file present at another place.

I don't know why it was not able to save if it was opened by shortcut/allies in xcode but by overwriting(Copy and Paste) the orignal files to that shortcut my problem was solved.

Regards Umair Bhatti


1.Right click on that file 2.Go to Show in Finder . 3.Click on get info . 4.Goto Sharing & Permission

Everyone,username,Fetching & selection ----You can choose appropriate read write option.


I have face this issue many times. I followed below steps to fixed this.

1. Select file->Show in Finder
2. Copy those file and past different destination.
3. Remove those file from xCode (to selecting show in finder)
4. Then again add those files from other destination to actual location 
5. Clean code and run the code.


Another possible reason is that the file you are trying to modify is an alias (i.e. a soft link).

You will have to modify the source file directly in this case.


Thanks @Wayne Cochran,

When I use Xcode to save it, I rebooted the machine several times, and all failed.

So I changed to Visual Studio Code to edit and save. Then it's OK.

Just change the file editor


This can happen when you are working with a network hard drive (or are on a cloud) and not connected to the network (connection lost)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜