在为 android unity 构建时出现这些奇怪的 xcode/iOS 错误

Getting these strange xcode/iOS errors when building for android unity

正在使用的东西:

  1. Unity编辑器版本:2019.3.0f3
  2. Firebase Unity SDK 版本:6.8.1
  3. 正在使用的 Firebase 插件(身份验证、数据库等):分析和消息传递
  4. 您正在使用的其他 SDK(Facebook、AdMob 等):Facebook
  5. 您在(Mac、Windows 或 Linux 上使用 Unity 编辑器的平台:Windows
  6. 您的目标平台(iOS、Android、and/or 桌面):Android
  7. 脚本运行时(单声道,and/or IL2CPP):IL2CPP。

首先,我的项目完全不知道 iOS,我也没有下载 iOS 模块,但我仍然收到这些似乎与 iOS 有关的错误. 我已经关注了 Known Issues 并删除了 .NET 3.x 两个 DLL,现在我的解析文件夹如下所示 -

在此之后我还做了资产 > Play Services Resolver > Version Handler > Update thing 但运气不好,所以这是我得到的日志,

第一个日志:

BadImageFormatException: Could not resolve field token 0x040000dc, due to: Could not load type of field 'Firebase.Editor.XcodeProjectModifier:projectInfoDoc' (2) due to: Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none> assembly:F:\Unity Projects\Space Invaders\Assets\Firebase\Editor\Firebase.Editor.dll type:XcodeProjectModifier member:(null) signature:<none>
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnPostprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at <83a73882c51c4602b3d34743827d03e7>:0)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass17_0.<OnBuildPostProcess>b__1 (UnityEditor.Build.IPostprocessBuildWithReport bpp) (at <83a73882c51c4602b3d34743827d03e7>:0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at <83a73882c51c4602b3d34743827d03e7>:0)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()

第二个日志:

Error building Player: BadImageFormatException: Could not resolve field token 0x040000dc, due to: Could not load type of field 'Firebase.Editor.XcodeProjectModifier:projectInfoDoc' (2) due to: Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none> assembly:F:\Unity Projects\Space Invaders\Assets\Firebase\Editor\Firebase.Editor.dll type:XcodeProjectModifier member:(null) signature:<none>

我卡在这一步了,我想不通了,我到处搜索,但找不到任何东西,希望最好;)

好的,我通过将这个 iOS Build Support 模块添加到 Unity 来解决它。

我只需关闭 Unity 然后重新打开它就可以修复它!