c# - 如何解决 Unity3D iOS 构建中的 AOT 和代码剥离

标签 c# json unity3d il2cpp

当 IL2CPP 编译器开始从您的 iOS 构建中的外部程序集 (dll) 中剥离您的代码时,您应该怎么做。导致您的 JSON 反序列化代码中断。

最佳答案

1) 确保您使用的是 JSON.Net 的 Unity3d“调整”版本。您可以在此处找到最新版本:Json.Net.Unity3D .此版本不使用动态代码 - 因此对于 Ahead-of-time 编译器来说是“安全的”。

2) 确保将正确的保留行添加到 Unity3D“link.xml”文件中:

<linker>
  <assembly fullname="AssemblyName.Common">
     <type fullname="AssemblyName.Common.*" preserve="all" />
   </assembly>
</linker>

* 将确保保留所有 namespace 和所有类,并且不会被删除。

应该这样做。

关于c# - 如何解决 Unity3D iOS 构建中的 AOT 和代码剥离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44964702/

相关文章:

c# - 在 Deedle 中选择特定行

c# - 将 byte[] 转换为图像 Windows Phone

android - 如何使用 Retrofit 发布复杂的 JSON 参数

c++ - 全屏应用

android - Android 上触摸释放时触发 OnPointerExit() 的解决方案?

c# - 文件上传错误 WCF WEB API(预览版 6): Cannot write more bytes to the buffer than the configured maximum buffer size: 65536

c# - 如何在 ASP.NET Core 6 MVC 中创建 Startup 类

json - 获取特定流的codec_name

java - 将 json 解析为 Object 时出现 JsonMappingException

c# - int 值 + 1 的问题给出了意想不到的值