ViewController.h and ViewController.m are not created automatically - xcode

I am studying by self for application development.
OS: MacOS
Software: Visual Studio(8.10.11 - build 8) for coding
Xcode(13.1)
I am referring a help article below published by Microsoft since I am using Visual Studio.
Ref; https://learn.microsoft.com/en-us/xamarin/mac/get-started/hello-mac
However, I am sticking at Outlets/Actions section.
I open storyboard on Xcode, and tried to sync between UI change to ViewController.h file.
I recognized that I do not have .h nor even .m file.
Did I have to create ViewController.h file manually??
There was also a sentence like this below.
This stub .h file mirrors the ViewController.designer.cs that is automatically added to a Xamarin.Mac project when a new NSWindow is created. This file will be used to synchronize the changes made by Interface Builder and is where the Outlets and Actions are created so that UI elements are exposed to C# code.
I researched NSWindow but I am super newbie on App Dev. So I am about to lose my mind and wasting my time for a long (T_T)
Could someone help me here?
This Visual Studio ver will not create .h/.m file anymore?
Kind regards

I am sorry for this dumb question.
I still do not have any header file nor m file.
However, when I double clicked storyboard, I saw header and m file.
I used to open storyboard file on Xcode because I did not have an option to open from Visual Studio even though I right-clicked storyboard file like "open -> Xcode interface builder" stuff.
Anyway, the issue was resolved.
Case closed.

Related

My storyboard custom class property doesn't generate a custom class in Xamarin anymore?

I'm using Visual Studio for Mac and design my UI in a storyboard using Xcode interface builder.
I'm trying to create a custom class of a UILabel and usually I just select the control and add my custom class name in the class property in xcode, and when xcode synchronises with Xamarin, the custom class is generated as a new file in the xamarin project, but this has stopped working.
Actually is seems to have stopped syncing all together. Are there any logs that I can check to see why? I have restarted xcode. Visual Studio for Mac, cleaned the project, deleted the bin and obj folders from the active project and rebooted the machine without success.
Any tips is very much appreciated!
My answer is a workaround and not a true answer as this has never worked for me. I have always used Xamarin iOS Designer to create custom class, then after file generation, close xib/storyboard and reopen in Xcode Interface Builder. Double checking for [Register("ClassName"]` tag.
Select Label in iOS Designer:
View -> Pads -> Properties Add Class name in Class Field:
Should see custom class autogenerated in SolutionExplorer:
Ensure .designer.cs file has Register Tag:
Now you can close the .xib in VS for Mac and reopen in Xcode. It probably won't autocomplete. But any Outlets you create will be an instance of your custom class as well as any custom attributes specified in .cs files will apply at runtime. Not as convenient as creating the custom class with Xcode but at least now you can use your custom class with Xcode Interface Builder.
I love my XCode as well! Instead of doing what you used to do, you can
Open the file in Xcode interface builder as usual with the Label
Find and Open the ABCViewController.h file in the other XCode window.
Hold control on your keyboard, click on your label on the GUI and drag it to the ABCViewController.h file and it should prompt you to create an outlet and name the class.
Save and Quit, and you should see the new Properties in your ABCViewController.designer.cs file
There's definitely a new issue after the update as you can see here as well

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.

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.

XCode 4 stopped highlight and recognizing UIKit classes on project

Hi i get problem with xCode 4.
I develope project with XCode4 on home and on work.
And i store it on my USB flash drive.
Today i get some problem.
I open xib file for add outlet to code and get next error "Could not insert new outlet connection: Could not find any information for the class named ..."
Class exist and property of xib file setted correctly.
Could not insert new outlet connection: Could not find any information for the class named
Ok, think i, i write code and the connect using Files owner.
Next step i open code editor of .h class file and try to write UI... and see nothing. i dont get list of classes UI types
Next i saw what XCode code editor does not highlighting classes of UIKit and else frameworks too.
But i dont have this error on another projects and on it project but on home computer.
Some body have same problem?
Try this: Close your project. Choose Window > Organizer from the main menu. Select the Projects panel. Select and delete all copies of your project from the list. Open the project again (Xcode will rebuild the necessary information).
This will not delete your project, but the index and other information Xcode discovers about your project. As I said, Xcode will rebuild the information as soon as you re-open the project.
We had a really similar problem happen to us and none of the help out there worked. What did end up fixing it was deleting the .m and .h file from xcode (resource only) and then dragging them back into the project from the project folder. It seemed to relink everything and make it work again.
Just add .m files in Compile Sources under:
<My Project>
-- TARGETS <My App Name>
-- Build Phase tab
-- Compile Sources
It fix the problem.
I noticed that .m file was moved inside en.lproj folder.
Just delete (reference only) the .m file from the Xcode and moved .m out of the en.lproj.
Add it again.Don't worry, you will get all your connections back.
It will fix the issue.

What is "Interface Builder Cocoa Touch Tool"

I got a code from a client to fix the bug (code was written by some other programmer), So when I open the xib file it simply hang my computer, i restarted my computer 3 times because of that and finally decided to see what's happening by opening the Activity Monitor and it turn out it is opening something with name "Interface Builder Cocoa Touch tool" and its eating all of my computer memory. Below is the screenshot.
But here is the interesting thing, it is not opening "Interface Builder Cocoa Touch tool" when open "xib" files from other projects, and i can't say anything about this project because this project has only one "nib" file.
But if kill that process, it open the nib file but an error start firing on me after every 10 sec. Below is the screen shot.
Note: App was written initially for ios 2.0 version and we are trying to move the project to ios 4.0. Is this thing has anything to do with this?
The best course of action here is to create a bug report at http://bugreport.apple.com/, uploading your broken nib file as an enclosure. That doesn't get you working again, so try one of these:
see if you can convince ibtool to write a working file, perhaps by doing some refactoring like changing one of the classes used then changing it back
find out whether the client is on the same version of Xcode: if theirs is newer, upgrade
use xmllint to see whether the xib is valid XML, and if not whether you can fix it in a text editor
recreate the xib from scratch if it isn't too complicated

Resources