Xamarin Forms iOS error MT5202: Native linking failed

1k views Asked by At

for my Xamarin Forms iOS project I always set Linker Behavior to "Link Framework SDKs Only" and it worked in the past but suddenly I cannot use this anymore. I get the following errors when I try to compile.

2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModelConfiguration
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModel
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLDictionaryFeatureProvider
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLFeatureValue
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLMultiArray
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5211: Native linking failed, undefined Objective-C class: MLModelConfiguration. The symbol '_OBJC_CLASS_$_MLModelConfiguration' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5211: Native linking failed, undefined Objective-C class: MLModel. The symbol '_OBJC_CLASS_$_MLModel' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5211: Native linking failed, undefined Objective-C class: MLDictionaryFeatureProvider. The symbol '_OBJC_CLASS_$_MLDictionaryFeatureProvider' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5211: Native linking failed, undefined Objective-C class: MLFeatureValue. The symbol '_OBJC_CLASS_$_MLFeatureValue' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5211: Native linking failed, undefined Objective-C class: MLMultiArray. The symbol '_OBJC_CLASS_$_MLMultiArray' could not be found in any of the libraries or frameworks linked with your application.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): warning MT5215: References to 'System.Net.Security' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): warning MT5215: References to 'Kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): warning MT5215: References to 'libEGL' might require additional -framework=XXX or -lXXX instructions to the native linker
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error MT5202: Native linking failed. Please review the build log.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : linker command failed with exit code 1 (use -v to see invocation)

Does anybody know what this means? When I set the Linker Behavior to "Don't link", the project is built without problems. I am not using Firebase, if this info helps.

1

There are 1 answers

1
Glorfindel On BEST ANSWER

I got this problem after updating several NuGet packages to their latest versions. It took a while to figure out which one was the culprit, but in my case it was Scandit.BarcodePicker.Xamarin; with version 5.17.0.10 I get the same errors as you, but with version 5.16.0.10 everything works fine.

In your case, it might be a different package. If your project is under version control, you can try to revert to an older commit and see if it builds and work from there. You also might need to clean your solution.