Visual studio for Mac - "Error updating Xcode projects"

Feb 9th 2022 . Moe Rabay'a

Everytime I try to open any storyboard or nib files using Xcode through Visual Studio for Mac by right-clicking the file and choosing Open With|Xcode Interface Builder I keep getting this error Error updating xcode project which is really getting on my nerve lately.

I looked it up in Ide.log from Help|Open Log Directory and the issue was I needed to add an attribute:

Xamarin.Designer.iOS/XcodeIntegration/XcodeSyncing/XcodeProjectTracker.cs:780
ERROR [2022-02-09 09:52:36Z]: Error updating Xcode project
Xamarin.Designer.iOS.XcodeIntegration.ObjCIntegration.ObjectiveCGenerationException: Could not generate outlet 'UsecasesTextField' in class 'Sample.iOS.Core.UsecasesAddController' as its type 'Sample.iOS.Core.PaddingTextField' could not be resolved to Objective-C.

Hint: Try adding [Register ("PaddingTextField")] to the class definition for Sample.iOS.Core.PaddingTextField.

Look through the file and find the most recent Error updating Xcode project. I fixed mine by adding [Register ("PaddingTextField")] to a class I had.


Before:

namespace Sample.iOS.Core
{
    public partial class PaddingTextField : UITextField
    {
        public PaddingTextField(IntPtr handle) : base (handle)
        {

        }
    }
}

After:

namespace Sample.iOS.Core
{
    [Register("PaddingTextField")]
    public partial class PaddingTextField : UITextField
    {
        public PaddingTextField(IntPtr handle) : base (handle)
        {

        }
    }
}

Voilà now i'm able to use Xcode again with Visual Studio. 😬