How do I recover a storyboard in xcode? - xcode

I have a little bit of a situation here. A few days ago, I accidentally deleted my storyboard, so immediately went into my trash and dragged the storyboard back into the project. Everything worked fine. But then I just emptied my trash and the storyboard no longer appears to be in my project; the storyboard file is showing up red and when I click on it, nothing loads. To my dismay, I thought all was lost so I started building a new storyboard and connecting the classes, outlets and actions.
I then went to build the project on the simulator, and it's building with the OLD storyboard. I thought it might just be loading it from memory so I deleted the app on the simulator and built the project again. Same thing again. So then I built it to my iPhone and somehow the old storyboard is still there even though I can't find it anywhere in my project.
What's going on here? Does this mean I'll be able to recover my storyboard?
Also, when I open the project inspector and go to Build Phases > Copy Bundle Resources, and right click on Storyboard.storyboard, and click show in finder, It shows my new storyboard.

1 - There is a place in Derived Data with following path:
/Users/<Your user name>/Library/Developer/Xcode/DerivedData/<Your App Name>/Build/Products/Debug-iphonesimulator/<app Name.app>
Browse to that location.
2 - On your .app file, right click -> Show Package Contents.
3 - In resulting directory list, browse the folder Base.lproj. Under that you are likely to find your old storyboard.
If you have done Delete Derived Data from XCode organizer, you are not likely to find anything up here. But fortunately, XCode doesn't delete it twice against your own wishes.
So try your luck.

I also faced same problem in Xcode 7.
But when I copy and paste it from Derived Data. I got
"Interface Builder cannot open compiled nibs"
So If you delete storyboard by reference. First, check your project folder (using the Finder). If it's there, you can drag it back into your project in Xcode, or you can use the “Add Files to …” menu option. that file is work perfectly.

Related

Why the Resources direrctory is not visible on my project navigatior

I just started learning SwiftUI and trying to follow the steps of the Building lists and navigation example from Apple. Although copied and existing on the project directory, I noticed the Resources directory is not visible in my project navigation on Xcode.
The build is successful, but since the app tries to read landmarkData.json file from that directory, it throws:
Could not find landmarkData.json in main bundle.
Why doesn't the Resources show up on Xcode? How can I fix this issue?
Thank you so much
Here's some things you can verify :
Verify if the clock is selected in the search bar. If so, de-select it.
Try deleting the Ressources folder in your projet files. Then, drag and drop it in your files navigator (left panel in xcode).

How to add storyboard back to xcode after accidentally deleted

I accidentally deleted my storyboard from the Xcode project. I followed this thread : Accidentally deleted Main.Storyboard and fortunately I found it in Base.lproj folder.
But I'm having trouble to add it back to Xcode project. Since I'm new to iOS and Xcode still I couldn't add it back to my project. I can open it separately.
Can someone point me out how can I add it back to my project? Any help would be appreciated.
drag and drop it to Xcode's project navigator
uncheck "Copy items if needed"

I deleted Main.Storyboard, recoverd it but

I deleted Main.Storyboard. I recovered it by dragging it back to the project in xcode. However, now it does not show in Base.Iproj (other than that everything is working).
I tried moving it back to Base.Iproj but when I do that, nothing shows in xcode.
What do I need to do to restore the project?
First move the Storyboard file to Base.Iproj, then drag it to project in Xcode. This will add the file to the project properly.

.xib files not showing up in MonoTouch

Right after building for the simulator I got an error message saying MonoTouch stopped unexpectedly and it shut down. So I closed Xcode and reloaded both. Now, I can't see my .xib files inside the MonoTouch file tree. I can open the .xib files directly in Xcode, but none of the resources need for the files are visible (for instance, images stored in the Resource folder).
How can I get these .xib files associated correctly again?
I fixed this. Had to go back and add each of my existing .xib files back into the project by right clicking on the appropriate folder and then finding the .xib file in the project folder. Once I added them all back, everything worked as expected

MonoDevelop is not generating IB outlets for my MonoMac project

I am getting back in to MonoMac, and straight away, experiencing problems.
I have added my outlets and actions to my XIB files, and linked them with IB controls, saved my XIB, and returned to MonoMac, and it is not regenerating the C# files, so the bindings are not linked - I cannot use them.
What happening? I am using the latest stable versions of everything (MonoMac did all its updates).
Thanks
This happens sometimes. I you are using a XIB file generated by MonoMac as default resources, you just need to close both MonoDevelop and Xcode, go to your project folder and clear the bin and object folders. Run the MonoMac, double click your XIB file, edit it in Xcode, press the Command+S buttons 2 or 3 times to make sure the files get changed so MonoDevelop will sync them, and your C# files will get generated...
But I had a situation that this didn't work and I couldn't figure it out and that was when I started an Empty MonoMac Project and added an Empty XIB file to it! The C# files do not get Sync after 5 tries and I didn't waste my time trying to fix it. Created a Document MonoMac project, deleted unneeded files and continued my work.
Hope it helps.

Resources