【问题标题】:Undeclared Identifier error Unity IOS to Xcode未声明的标识符错误 Unity IOS 到 Xcode
【发布时间】:2016-01-30 01:59:32
【问题描述】:

我有一个 Unity 5.3.1 iOS 项目,它也使用新的多人游戏网络 UNet。可怕的东西。当我构建并运行项目时,我在 Xcode 中收到以下错误:

Use of undeclared identifier `IL2CPP_RAISE_MANAGED_EXCEPTION`

项目在 Unity 编辑器中运行良好。它在一个巨大的 Bulk_Generics_10.cpp 中 处理System.Comparison1<UnityEngine.Networking.NetworkSystem.PeerInfoPlayer的脚本

这是发现错误的代码块。

 // System.Void
 System.Linq.Enumerable/<CreateDistinctIterator>c__Iterator3`1<System.Object>::Reset()
 extern TypeInfo*
 NotSupportedException_t1382227673_0_il2cpp_TypeInfo_var; extern const
 uint32_t
 U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_MetadataUsageId;
 extern "C"  void
 U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_gshared
 (U3CCreateDistinctIteratorU3Ec__Iterator3_1_t1454147488_0 * __this,
 const MethodInfo* method) {    static bool s_Il2CppMethodIntialized;   if
 (!s_Il2CppMethodIntialized)    {       il2cpp_codegen_initialize_method
 (U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_MetadataUsageId);
        s_Il2CppMethodIntialized = true;    }   {
        NotSupportedException_t1382227673_0 * L_0 =
 (NotSupportedException_t1382227673_0 *)il2cpp_codegen_object_new
 (NotSupportedException_t1382227673_0_il2cpp_TypeInfo_var);
        NotSupportedException__ctor_m149930845_0(L_0, /*hidden
 argument*/NULL);       IL2CPP_RAISE_MANAGED_EXCEPTION(L_0);    } }

看起来 Unity 并没有将其完全交给 Xcode。我想知道是否需要在 Unity 中进行一些调整。

我该如何纠正这个错误?

【问题讨论】:

  • 你能解决这个问题吗?迁移到 Unity 5.3.1p3 后开始面临这个问题。
  • 我从 Unity 网页下载了补丁,问题就消失了。找到与您正在使用的 Unity 版本匹配的补丁。

标签: c# xcode unit-testing unity3d unity-networking


【解决方案1】:

这是一个新问题,不同平台的构建包在安装程序中是可选的。如果您安装一个平台,然后升级您的 Unity 版本,但在第二次安装时未安装该平台,则旧版本的平台将保留并导致问题。

我的解决方案是彻底清除我的 Unity3d 文件夹并使用正确的平台重新安装。

相关话题:http://forum.unity3d.com/threads/il2cpp_raise_managed_exception-undeclared-identifier.382377/

【讨论】:

  • 感谢 Meursault334!我从 Unity 页面重新安装了最新版本并应用了补丁。一种或两种都有效。
【解决方案2】:

据我所知,System.Linq 受 iOS 支持。

这里也有一个关于这个的线程,

来自 Linq for Collections 的大多数 Linq 扩展方法都不适用于 iOS 上的 IEnumerables,因为它们需要不受支持的 AOT 运行时编译器。

不过,Asset Store 上有一个类似于 Linq 但不需要运行时编译器的 Linq for iOS 库。所以你可以在 iOS 上使用它。

来源:http://forum.unity3d.com/threads/linq-on-ios.84147/

【讨论】:

  • 感谢哈姆扎哈桑!我没有自定义或尝试使用 Linq 库,但如果错误像它们出现的那样神秘地返回,我会使用这个提示!
猜你喜欢
  • 1970-01-01
  • 2017-12-22
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
  • 1970-01-01
  • 1970-01-01
  • 2013-01-22
  • 2011-10-25
相关资源
最近更新 更多