Visual Studio for Mac: "Error updating Xcode project" opening Storyboard in xCode
I’ve been getting the error Error updating Xcode project
on my Mac when trying to open a storyboard using Xcode in Visual Studio, by right-clicking the storyboard and choosing Open With|Xcode Interface Builder
.
Going to Help|Open Log Directory
and then opening Ide.log
I got a clue:
WARNING [2019-11-26 18:42:18Z]: Slow command update (28ms): Command:MonoDevelop.Ide.Commands.ViewCommands.OpenWithList, Method:MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectFileNodeCommandHandler.OnOpenWithUpdate, CommandTargetType:MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectFileNodeCommandHandler
ERROR [2019-11-26 18:42:22Z]: Error updating Xcode project
MonoDevelop.MacDev.ObjCIntegration.ObjectiveCGenerationException: Could not generate Objective-C code for action 'LanguagePicker_Activated' in class 'AppleWatchAlexa.WatchOSAppExtension.LaunguageInterfaceController' as the type 'System.nint'of its parameter 'sender' could not be resolved to Objective-C
...
For some reason it doesn’t like the System.nint
in the generated code for the View Controller. I edited the generated code and removed the offending lines.
Before:
[Action ("LanguageButton_Activated")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void LanguageButton_Activated ();
[Action ("LanguagePicker_Activated:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void LanguagePicker_Activated (System.nint sender);
[Action ("LogoutButton_Activated")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void LogoutButton_Activated ();
after:
[Action ("LanguageButton_Activated")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void LanguageButton_Activated ();
[Action ("LogoutButton_Activated")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void LogoutButton_Activated ();
I committed the cardinal sin of editing generated code, but at least now it opens!