I was trying to undo changes on my project to the last committed Source Control state, however when I pressed 'Discard all changes' weird behaviour happened.
The first time some of the files reverted whilst others didn't. So I pressed the button again and a blurb popped up saying something about needed to re-save the 'xcworkspace'. I pressed okay and half my files disappeared from the xcode file list on the left, really random files that hadn't been edited at all. So I decided to press revert again to see if I could get back to my original state, and now all my files have disappeared from the xcworkspace. So my screen now looks like this:
I have tried restoring the files from my trash (as this is where random ones have appeared) but the workspace is never restored. I use MapBox so I have 2 projects building in to 1 workspace, but the podfile will now not install.
Can anyone give me advice on how to get this back to it's original state as I have been trying for a few hours but can't find any information.
I felt horrible when I did this. I really thought I had to rebuild everything over again. Luckily, it was easy to repair.
Xcode removed all the "non-essential" files. This includes your Podfile (and if applicable, GoogleService-Info.plist).
To Repair:
Go to Terminal and create a Podfile in your project folder $ pod init
Update your Podfile with the pods you need
Run $ pod install
(4.) To re-generate the GoogleService-Info.plist file, go to your console.firebase.google.com > Settings > Project Settings > Download the latest config file for the appropriate project iOS app and save to your local project folder. Your workspace should recognize the file in the Project Navigator list.
Once you open your workspace, select new Scheme and everything should be back to normal.
To avoid future regressions:
Go to Terminal
git add -A
to add the pod files, then
git commit -m "Save pod files"
to save pod files. I believe git from Xcode ignores the pod and scheme files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With