Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode has lost associating from xib to .h file (MonoTouch)

When I am editing an XIB in XCode I don't get the associated .h file to show up in the assistant editor window. Other XIB's work fine.

This is a problem as it's the way I create outlets by dragging onto the assistant window. If I open the .h file manually in another window I can't associate an outlet this way either. The .h file exists.

Also, my project is MonoTouch and therefore I invoke the opening of the file from MonoTouch. I assume it's a problem originating in MonoTouch and not Xcode.

Someone please help, or I will be forced to learn Objective C soon and quit with this MonoTouch business.

like image 681
user1060500 Avatar asked Jan 16 '23 18:01

user1060500


2 Answers

Sometimes there is a different solution, such as when the controller file is RENAMED.

When this happens, edit the .XIB file with the Source Control Editor (right click on .xib, Open With->Source Control Editor), and make sure that all references to the name of the controller are correct and that the path and name of the .h file are correct.

Look in the "IBClassDescriber" element specifically. The "className" under the "IBPartialClassDescription" element and the "minorKey" under the "IBClassDescriptionSource" element must be correct. MT will generate a .h file with the same name as the controller.

After making the changes, save the file, choose Build->Clean All, then double-click the .XIB file to open it in XCode.

It may or may not work for you, but it worked for me when everything else failed.

like image 68
Rodney Willis Avatar answered Jan 29 '23 03:01

Rodney Willis


As Stuart mentioned in his comment, deleting the /obj folder under the project which contains the .xib files, force MT to regenerate .h files

like image 44
Francesco Avatar answered Jan 29 '23 03:01

Francesco