Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode: The document: "<document name>" could not be saved. The file has been changed by another application"

Tags:

xcode4

Since starting to use XCode 4.2 I've more-or-less routinely had the error:

enter image description here

with various substitutions for the filename. This is normally when Xcode is doing an autosave, so it happens seemingly at random. I generally click "Save Anyway" and my recent edits are then preserved, although there is a significant probability that Xcode will then hang. I don't typically lose much when it hangs, other than a minute to shoot it and get it to restart, but still...

I don't open any of these files in any application except XCode. I have not been able to figure out the pattern, although it may have to do with popping back and forth between files. The last time I noticed it, I also noticed that the previous round of edits to that file hadn't taken. So some other editor had not saved the file.

Enough preamble: here's the question:

Are others running into this? Has anyone narrowed down what causes it? Is there a setting I can change to prevent it? Is there something I can change in my behaviour?

like image 803
DRVic Avatar asked Apr 11 '12 13:04

DRVic


2 Answers

You will get this happening when

1) There are locally unsaved modifications (the navigator icon will be shaded)

2) AND something else has changed the file outside of Xcode. For me this occurs when I do an external update from svn on the command line or via Versions

What do you have that is modifying and saving the file outside of Xcode? Anything?

Check your source control (if any) and figure out if something you are doing is causing the conditions to be met.

like image 98
Warren Burton Avatar answered Oct 22 '22 06:10

Warren Burton


Well I had the same problem when I was trying to Localize my files. Then I noticed that every time the message was popping up was because the icon of the selected file in the Project Navigator was grey, which means that was not saved. So what I did was to save the file (Cmd+S) before doing the action that made the "changed by another application" message to appear, in my case the Localize button.

like image 27
arniotaki Avatar answered Oct 22 '22 05:10

arniotaki