Is it possible to find a deleted xcode file? - xcode

I highlighted a line of code I was going to delete after building and running the app. After I ran the app, the code was still highlighted so I pressed delete and my entire class was deleted... I am an idiot...
The file did not go to the trash so I thought xcode might store it somewhere, does anyone know if it is possible to retrieve this file?

you can easily revert if you are using version control. if you are not using it (yet), you should -- worse things happen.
if you don't use version control and you use xcode's snapshots... you could look there. you may also be able to find it using Time Machine.
but... add "learn version control" to your #1 thing to learn this week for development.

I used the Disk Drill to restore mistakenly deleted files.
check http://www.cleverfiles.com/

Related

XCode 4.2 Source Control problems

I seem to have a major problem. I opened up Xcode and my main view controller code seems to have been replaced with the original code, it's all gone. All my other files have the little 'M' for modified icon next to them, this problem file however does not. It seems like it's gone back to the original version.
Now, Can I go back to my modified version, or is it all gone? This is a for a test app so although not crucial, I'd really prefer to not lose it all :)
Thanks
Just putting an answer here as I hate to leave things with no answers. Dropbox sorted my problem as I had a backup copy of everything, and I am yet to find out what went wrong. I'm now using a combination of Dropbox and a GIT repo to keeps things save.

Can Xcode ask / react to file changes outside of the IDE?

Is there are means whereby if files are altered outside of Xcode, that a warning in can be shown to ask if you want to refresh the file? This feature is available in Visual Studio, for example.
As a temporary solution, were working on source files in a Dropbox folder.
Although growl notifies us that some files has changed, Xcode doesn't know about these changes.
No, Xcode won't do that, and since there's no support for plugins you're pretty much stuck with that behavior. Some suggestions:
Create a local git repository (Xcode can do this for you when you create the project, I don't know if you can do it once it is created.
Use another IDE, like AppCode (this isn't even a solution, just came to me and I decided to add it).
With a version control system you can see the little 'M' on edited files, browse changes, etc. But since you wrote that this is a temporary solution I bet you already know this.

Xcode not predicting

Am new to objective-c and xcode, and i love programming with them. But am facing a problem with xcode this has occurred quite a few times before, i.e the xcode's Auto-Suggestion mode is not working.
By Auto-Suggestion i mean- when i type say two letters 'UI..' xcode predicts the remaining word to be "UIColor, UIButton, .. etc".
Same for the instance methods eg. you type 'init ' and a list is shown as "initWithFrame,
initWithNibName, .." and so on, which makes coding so easy.
But after i performed some operation like undo or delete i don't remember what i did exactly, this auto-prediction is not working and this is happening only on a particular file.
Any idea what i did wrong to make this happen?
Thanks
Xcode sometimes freaks out and exhibits this behavior. Best you can do in this case is clean your project (cmd-shift-K), close Xcode, then re-open it.
I have noticed this behavior especially when using #defined macros extensively.
I know this post is old, but the correct way to resolve this issue is to clear your derived data. After cleaning the derived data and restarting Xcode, your project will say "Indexing" which is the process of setting up everything required to make this feature work. After that, everything should work again.
To clear derived data go to Xcode->Preferences. Then click the little arrow next to the path to the derived data folder. Finder will open with the projects in derived data. Simply select and delete the one specific to your project giving the issue (Don't worry, this will not affect your project).
If there are any compile errors, then also prediction doesn't work properly. try resolving them first.

I created an xcode project with the same name and I accidentally overwrote the old project

I created an xcode project with the same name and I accidentally overwrote the old project. How do I get it back? All old source is gone and it isn't in the Trash. It has all been replaced with the new project template code.
If you have backups/source control, you can re-sync your old version.
Back up/shelve what you have now, and leave it checked out/on your system. Then, try to replace just the project file(s), leaving your source code and data in-place. Re-do the changes to your project(s), and you will have undone the damage.
If you don't have source control or backups, and you didn't delete your code/data, you may still be in luck. You'll have to re-create your project files from scratch, rather than your last save point, but you can simply import your existing code.
If you don't have any of those, and you deleted the source, then you are out of luck
No matter what, your next step is to get and use source control and/or start doing automatic backups of your code. Everyone makes mistakes like this, and this is why source control/backups exist. You must use them.
From the other discussion, it sounds like your best hope might be an OS X undelete utility, one example:
http://www.prosofteng.com/products/data_rescue.php
I hope you've not been doing much with the drive though as any file, email, or anything else you've saved to disk could have been overwriting what used to be there. But, it's better than doing nothing.
I would boot off a separate drive before you downloaded that to run it.

svn conflict xcode project file while working in team

I'm working in a team that's developing iPhone application (about 7 people). We use SVN for source code control of iPhone code, we keep running into conflict issues with xcode project file and iPhone nib file. I think there has been a question asked about this problem : How to merge conflicts (file project.pbxproj) in Xcode use svn?. I want to ask if anyone has ever come up with a satisfactory solution to this. Since our team is fairly decent in size (7 people), manually resolving conflict in xcode project file everytime someone changes code, or adding new object into nib file is a huge productivity waste. Has Apple engineers ever thought about this issues when they wrote their own iPhone apps ? I have been looking for a satisfactory solution using Google and Bing, not yet found one.
Thanks,
This is definitely a HUGE flaw with xcode. I'm on a team of similar size and here's what I do to make the process as painless as possible:
SVN update (ALWAYS do this before a checkin as well):
quit Xcode. The quickest way to do this is to use Alfred and type "forcequit xcode"
"svn up" in the project folder from command line
If you have any merge conflicts with the project file, hit "edit" to open in emacs or whatever
search for "======" to find merge conflicts; delete that line as well as the "<<<< mine" and ">>>>" lines
save & exit. hit "r" to mark project as resolved.
re-open project - "open MyProject.xcodeproj/"
With a bit of practice you can get this process down to under a minute (I do this several times a day).
for NIB files, DO NOT work on while someone else is working on it. There's no real way to merge them. Make your changes quickly and check in right away (there aren't many cases where 2 people need to work on a NIB file at the same time anyway). For less complicated views, just lay them out programmatically.
Try installing SourceGear DiffMerge. This is a merge tool that should make it a lot easier to merge the changes. Also see this blog post about configure XCode to use DiffMerge

Resources