How to add storyboard back to xcode after accidentally deleted - xcode

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"

Related

Why can't I delete this file from my Xcode project?

Being new to Xcode, I foolishly added "wrong_answer.mp3" via "add files to.." to my project and in the wrong place, but I cannot remove this reference from my project. I deleted the underlying file from the file system, but I cannot find in Xcode where I can remove this reference... Can someone advise how to remove this reference from my project ?
UPDATE: Yes, I have tried delete/backspace and edit menu "Delete".
Some options
Restart Xcode
Clean project, Product—>Clean
Put the file back and delete it from Xcode

Xcode 9 / 10 resets project navigator state

Usually Xcode project navigator saves open/closed state of the project navigator folders, so when you open the project you always see the same state as before. However it's not the case in one of my projects in Xcode 9. Every time I open it Xcode project navigator opens some folders I don't need and closes the others. Is there any way to fix this annoying bug?
There is an easy workaround: exit Xcode and delete appropriate xcuserdata folder:
YourProjectName.xcodeproj/xcuserdata // no Cocoa Pods
YourProjectName.xcworkspace/xcuserdata // for Cocoa Pods
This effectively resets all user settings for the project, but Xcode would be able to start saving them again. More info on those folders.
Xcode 10 update: same bug, same workaround

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.

How do I recover a storyboard in 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.

Header file for view controller not created with MonoTouch

This question is the same as this Missing h-files and Assistant Editor not working because of it (monoTouch/MonoDevelop) but none of the answers work for me. When I double-click the XIB file from monodevelop no header file is created in XCode 4.2, even after I edit the XIB in Xcode and re-save, or when I quit Xcode and monodevelop and re-open. I have expanded every folder in Xcode and there is no ViewController.h file anywhere.
I've had this happen quite a few times :( The solution is to manually create the partial class in MonoDevelop, inherit from the UI class you need, and finally add the Register attribute.
[Register("MyCustomView")]
public partial class MyCustomView : UIViewController {
....
}
Once you do that, and save your code in MonoDevelop it should automatically rebuild the xcode project file for you.
I had this same issue, and as of 5 minutes ago it seems to have resolved itself. I don't know what the direct reasoning for this was, but it started after I closed xcode, monodevelop and restarted my mac. It didn't work the first time I rebooted, but I noticed that there was another xcode project open when I double-clicked on the xib in monodevelop. So I closed the project and xcode again. Next time I double-clicked on the xib it was there!
So, my guess is it is some kind of fluke or system caching issue. If you haven't been able to resolve it yet maybe try doing a reboot so the system cache can be cleared and make sure you don't have another project open in xcode when you try to open the xib from monodevelop?
I have noticed that deleting the "obj" folder of your project often helps. In there MD is storing all the helper fiels required by Xcode. This folder is not properly cleaned if you "clean" your solution from the build menu.
Quit Xcode, delete the folder, double click your XIB and the folder will be recreated.

Resources