MonoDevelop is not generating IB outlets for my MonoMac project - interface-builder

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.

Related

Issue with Xcode in Main.Storyboard

I've been working on a project the last few weeks in Xcode and everything's been great. Main.Storyboard all of a sudden, will not load or open. Other projects open fine. There hasn't been any significant changes in this project. The last thing I tried doing was adding a navigation bar to one of my view controllers, to add buttons or items. I also tried adding a navigation item. Things started to complicate after trying to do these things. I have the latest version of Xcode, my project settings are linked correctly and tried rebooting my Mac but it doesn't solve anything. Does anybody know what may have caused this error and how to resolve?
The easy way:
Check out the latest working version of the storyboard file and try the changes again. Likely something odd and transient happened that corrupted the existing storyboard file (I've seen it happen with managed object model files before which are also XML underneath).
If there are too many changes to redo them:
Make a copy of the current storyboard file outside the repo and then checkout the latest working version of the file from the repo.
Diff the two files moving over changes that make sense from the troublesome file keeping an eye out for balanced tags (i.e. if a view has an opening tag but no closing tag Xcode will get confused).
Try opening the modified storyboard in Xcode. With luck it will open and be fine. Otherwise you will need to do a bit more digging or go back to option one and redo the changes.
I downloaded your repo and I can open Main.storyboard just fine:

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.

.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

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.

Monodevelop migrate 2.8 didn't add .h files

I just upgrade my MonoDevelop to the latest version (2.8). I also installed XCode4, since it's fully supported now. When opening my solution (which consists of several projects) I was asked to migrate my solution. I did this and saved everything.
However, I think something is missing. When I open the .xib file, the project on the right doesn't show .h files, like shown in the tutorial.
It also shows warnings that the outlets were not found in XCode.
When I add a new screen, it creates the .h file as it should and shows this in XCode. However all existing screens don't have these files, which makes it impossible to add/change outlets.
How can I fix this.
Check that your classes you expect to see in Xcode have explicit [Register("SomeName")] attributes, which register them with a name usable from Xcode/Obj-C/IB.
I would expect an imported project to have those attributes already, since they're required for xibs to be able to load the classes by name, but you could maybe have got away without those attributes by using outlets on "File's Owner".

Resources