tj75467
tj75467

Reputation: 113

What to do if you accidentally remove the reference to a file in Xcode?

In the middle of coding an app, I wanted to delete a button. What I did not realize was that I was actually selected main.storyboard. When I pressed backspace to delete main.storyboard I pressed "Remove reference". At this point I tried command + z, but ,unfortunately, main.storyboard did not come back.I tried to run the app but I kept getting signal SIGABRT.

My question here is if you accidentally remove the reference to a file is there any way of recovering it?

Upvotes: 3

Views: 9190

Answers (2)

Toru
Toru

Reputation: 1264

Only "Remove reference", the file is disappearing only from Xcode and remaining in your real folder. Try to add Main.storyboard again from Xcode file navigator like this.

enter image description here

Upvotes: 11

tj75467
tj75467

Reputation: 113

If you have accidentally removed the reference of a file in your Xcode project (such as main.storyboard or app.delegate) go find the file you removed the reference of in finder. Then drag and drop the file into where all of your files are located in xcode (on the left).

Similarly, if you have trash a file, go into your trash and just drag and drop the project back into xcode.

Hopefully this helps

Upvotes: 3

Related Questions