在统一中不能序列化列表<>仅在iPhone中使用xml序列化?

时间:2014-07-12 13:38:12

标签: serialization reflection casting unity3d xml-serialization

我不能仅在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序列化工作。但即使在此列表中,序列化也无法正常工作。但看起来数组可以序列化。

1 个答案:

答案 0 :(得分:0)

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

XML序列化在统一ios中几乎没用,因为大部分都被剥离了,或者你没有遇到JIT和AOT问题。