1

Given a working app in the iOS Simulator, is it possible to retrieve the code that is running the app? Or is there any snapshot functionality in Xcode that could be used to restore the codebase?

I accidentally nuked my whole project in Git with git update-ref -d HEAD. From what I understand, there is no way to undo this. I was trying to undo the first commit I made per this post, obviously with disastrous results.

I realize I'm probably screwed here but would love to hear any suggestions.

Community
  • 1
  • 1
Benjamin Martin
  • 1,795
  • 3
  • 15
  • 17
  • 2
    Nope, there is no way to essentially reverse engineer code from an app. In the future, you can create an alias for undoing commits with `git config --global alias.undo-commit 'reset --soft HEAD^'`. Then just type `git undo-commit` to undo the last commit. – timgcarlson Oct 06 '14 at 23:42

1 Answers1

1
  1. You can't "retrieve the code" from the simulator as it's not running the code, it's running a compiled version, basically it's an .ipa compiled for the processor your Mac uses.

  2. There is a Snapshot function, if you had it turned on you can restore your project state from one of the previous Snapshots. You can find the "Restore Snapshot…" item in the File menu.

It looks like this: enter image description here

Craig
  • 9,335
  • 2
  • 34
  • 38
  • Very helpful, thank you! I probably could have grabbed the snapshot from the last time I renamed a variable. Unfortunately everything was deleted except a `README` and `pods` directory, so the container for the project was gone. I'm rewriting everything now and it's far cleaner the second time through, so it's not all bad. – Benjamin Martin Oct 07 '14 at 15:41
  • How do you enable this feature? I am in Xcode 8 and do not see this as an option. – JeremyF Jan 24 '17 at 03:34
  • 1
    @JeremyF that was removed with the Xcode 7 release… you should be using the built-in source control now – Craig Jan 24 '17 at 03:39