在 Unity 中无法序列化列表<>仅在 iPhone 中使用 xml 序列化?



我不能在iPhone中单独使用xml序列化序列化列表类型,但它在所有平台上都有效。当我在iPhone中使用相同的代码时,我得到以下错误:

ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<System.Collections.Generic.List'1<string>, int> (System.Reflection.MonoProperty/Getter'2<System.Collections.Generic.List'1<string>, int>,object) while running with --aot-only.

at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteRoot (System.Object ob) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializer.Serialize (System.Object o, System.Xml.Serialization.XmlSerializationWriter writer) [0x00000] in <filename unknown>:0 
at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter writer, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00000] in <filename unknown>:0 

我尝试了很多序列化方法,没有任何东西在iPhone上工作,只有xml序列化工作。但即使在这个列表中,序列化也不起作用。但是看起来数组是可以序列化的

你真的需要XML吗?如果不使用json.net序列化。

XML序列化在unity ios中几乎是无用的,因为它的大部分都被剥离了,你会遇到JIT和AOT的问题。

相关内容

  • 没有找到相关文章

最新更新