deleted ViewController.m by mistake?

Discussion in 'iOS Programming' started by larswik, May 24, 2014.

  1. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    As I was deleting files I accidentally deleted a .m file. I tried to undo to get it buck but it is greyed out. The undo is greyed out and it is not located in the project folder. Can it be recovered? I did rename some ivars and xcode asked if I wanted to enable SnapShot, can I retrieve it from a saved version?
     
  2. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    Did you look for it in the Finder trash?

    And now you have learned why backups are important.
     
  3. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #3
    Yep, not in the trash. Seems like xcode deletes them without sending to trash. I hope there is a preference for that.

    I downloaded a program called Disk Drill. It is kinda free to scan the drive but when you want to recover you need to spend the money. But it has a view feature that is free. It found the delete viewController.m file but instead of spending $90 to recover I took screen shots of the documents and I'm retyping it now.

    Kind of solved the problem.
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    There are two kinds of people in the world. Those that have lost data and those that will lose data.

    Every programmer today should be using source-code control. You should learn how to use git. It's part of Xcode. You can have free online storage at a number of hosts suitable for modest sized projects. I've used bitbucket.com and there are others.

    You should also have a backup drive and use Time machine.
     
  5. TheWatchfulOne macrumors 6502

    TheWatchfulOne

    Joined:
    Jun 19, 2009
    #5
    I consider myself to be both simultaneously!

    This. And you can even add a git repository to an existing project. The version editor makes it really easy to compare files. It's perfect for those oh-I-wish-I-hadn't-done-that moments.

    This. Time Machine saved me from loosing several hours worth of work when I irreversibly made certain changes to the wrong database file.
     
  6. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #6
    Are you sure you didn't just delete the reference to the file?

    There are two options when you delete. I thought one moved to trash the other keeps the file where it was but de-references it from the project.

    oh yeah another +1 to source control and remember to check in your files regularly and branch before making changes to working code.
     
  7. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #7
    I check both in the trash can and also in the project folder. It was gone and what a sinking feeling you get in your stomach when that happens.
     
  8. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #8
    It's always quicker the second time. It's not fun but is quicker. :p

    Cold comfort of someone who has lost much productivity of the years to technology and backups.
     
  9. DannyBres macrumors 65816

    DannyBres

    Joined:
    Oct 30, 2007
    Location:
    UK
    #9
    Learn to use git and you will be able to recover things like this. Ray Wenderlick's site has an excellent tutorial.
     

Share This Page