Xamarin Forms iOS 错误 MT5202:本机链接失败
Xamarin Forms iOS error MT5202: Native linking failed
对于我的 Xamarin Forms iOS 项目,我总是将 Linker Behavior 设置为“Link Framework SDKs Only”并且它在过去有效但突然我不能再使用它了。当我尝试编译时出现以下错误。
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModelConfiguration
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModel
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLDictionaryFeatureProvider
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLFeatureValue
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLMultiArray
2>C:\Program Files (x86)\Microsoft Visual Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : linker command failed with exit code 1 (use -v to see invocation)
有人知道这是什么意思吗?当我将 Linker 行为设置为“不要 link”时,项目构建没有问题。如果此信息有帮助,我没有使用 Firebase。
我在将几个 NuGet 包更新到最新版本后遇到了这个问题。花了一段时间才弄清楚哪个是罪魁祸首,但就我而言是 Scandit.BarcodePicker.Xamarin;对于 5.17.0.10 版本,我遇到了与您相同的错误,但是对于 5.16.0.10 版本,一切正常。
对于您的情况,它可能是不同的包。如果您的项目处于版本控制之下,您可以尝试恢复到较旧的提交并查看它是否从那里构建和工作。您可能还需要清理您的解决方案。
对于我的 Xamarin Forms iOS 项目,我总是将 Linker Behavior 设置为“Link Framework SDKs Only”并且它在过去有效但突然我不能再使用它了。当我尝试编译时出现以下错误。
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModelConfiguration
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLModel
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLDictionaryFeatureProvider
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLFeatureValue
2>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : undef: _OBJC_CLASS_$_MLMultiArray
2>C:\Program Files (x86)\Microsoft Visual Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\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 Studio19\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(885,3): error : linker command failed with exit code 1 (use -v to see invocation)
有人知道这是什么意思吗?当我将 Linker 行为设置为“不要 link”时,项目构建没有问题。如果此信息有帮助,我没有使用 Firebase。
我在将几个 NuGet 包更新到最新版本后遇到了这个问题。花了一段时间才弄清楚哪个是罪魁祸首,但就我而言是 Scandit.BarcodePicker.Xamarin;对于 5.17.0.10 版本,我遇到了与您相同的错误,但是对于 5.16.0.10 版本,一切正常。
对于您的情况,它可能是不同的包。如果您的项目处于版本控制之下,您可以尝试恢复到较旧的提交并查看它是否从那里构建和工作。您可能还需要清理您的解决方案。