Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode Autosave Broken?

I recently changed from developing iOS apps on a MacMini to a new MacBook Pro (2.2 GHz Intel Core i7). While working in XCode, I occasionally get pop-ups when the system is apparently trying to do an autosave and runs into a problem.

The pop-ups state "The document [filename] could not be autosaved. The file has been changed by another application. Click Save Anyway to keep your changes and save the changes made by the other application as a version, or click Revert to keep the changes from the other application and save your changes as a version."

Examples of the filename are: AppDelegate.m, MyLoginViewController.m. There shouldn't be anything else that is changing those files.

I can't do anything within XCode until I choose one of the options. Sometimes it seems like the system is trying to overwrite my newest code with an old version of my code, sometimes it seems like it is trying to save my newest code. So, sometimes Revert is what I need to do to keep my current version, and other times Save Anyway is what I need to do. However, sometimes, I can't tell what the system is trying to do and I choose the wrong option and lose hours of work.

This has happened numerous times over a span of three weeks.

I am using OS X 10.7.2 and XCode 4.2.1. The code is on my MacBook's hard drive.

Does anybody have any idea why this is happening?

Thank you.

enter image description here

like image 804
user1139591 Avatar asked Jan 09 '12 21:01

user1139591


2 Answers

This is a huge problem, and it looks like it's Lion's force-fed "file-versioning" that is destroying work.

I typed quite a bit of code into my source and saved it regularly (pretty much after every complete paragraph). Suddenly I couldn't find an entire section that I'd just written. I even did a project-wide search, in case I'd accidentally entered it in the wrong file. Suddenly Xcode raised a dialog saying it couldn't autosave the file because it had been modified externally. Did I want to "revert", or save what was in the editor?

In the several times I've seen this come up on two systems over the past few weeks, I've chosen to save what's in the editor, thinking that obviously it must be the most recent version. WRONG. I hit "Revert", and the block of code reappeared.

There is so much wrong here, it's hard to decide what's the most offensive.

like image 167
Oscar Avatar answered Oct 11 '22 04:10

Oscar


Confirming that this happens on XCode 4.3.2 on an iMac running 10.7.4.

I have found that this bug may be related to having the same file open in more than one tab or window in XCode. If you carefully avoid ever having more than one window open on a given file at a time I think you can avoid this problem. However, it undermines the very useful ability to apple-click method names to navigate to the file that contains them.

This has cost me hours of original work and been the source of immense frustration. The derisive comments from others are simply inadequate.

I heard they had a complicated fix for it already at Apple, but unfortunately, it was "accidentally lost" and now they can't remember which files need what changes to make it work again. :-/

like image 25
Howard Cohen Avatar answered Oct 11 '22 02:10

Howard Cohen