user4038028
user4038028

Reputation:

ios/xcode: Posssible to recover lost main storyboard from build in simulator?

Some time ago, I accidentally deleted the main storyboard of my app. I read to find it in the trash folder and just drag it back to you project which I did.

However, I did not realize that doing this does not actually transfer the file back where it belongs. It just gets the app to reference the storyboard in the trash folder.

Having largely forgot about this, in a misplaced fit of organization, I emptied my trash today and now the main storyboard shows in red in the app and is missing.

One person answering a similar question said to look in the base.lproj directly of derived data. I did this and found a launch screen but no main storyboard.

I do however have the app still running in the simulator.

Wondering if there is anyway to recover the storyboard from there.

I also btw tried the data recovery route with drill disk but it did not turn up the file.

Do you have any suggestions?

Upvotes: 0

Views: 946

Answers (1)

matt
matt

Reputation: 534925

I did not realize that doing this does not actually transfer the file back where it belongs

Well, it does if you ask it to. When you drag something into the project, you are shown a dialog with a checkbox asking whether you want to copy that thing into the project folder. If you didn't check that checkbox, that was your own fault.

You can't retrieve the storyboard from the simulator or (same thing) from the built app, because they are not the same storyboard. The built app contains a compiled version of the storyboard (a .storyboardc file). Thus, you cannot restore from this the source of the storyboard, any more than you could extract the source code of a code file from the compiled binary of a built app.

You're likely to have better luck retrieving the storyboard from a backup. For example, perhaps your Mac has Time Machine running; if so, you've got the original storyboard in a recent Time Machine backup. And of course any decent programmer who cares about his work will be keeping that work under version control (e.g. git), so the storyboard will be present in a commit saved before you moved it to the trash.

Upvotes: 1

Related Questions