- Home /
iPhone crashes when using a SerializationBinder
Hi, I came across this question a while ago regarding saving and loading files through scripting. I am using BinaryFormatter to serialize and deserialize my data. When I try plugging in a SerializationBinder, I can save and load perfectly in Unity, but when I run on device, it crashes. Specifically, it can serialize() on device, but it crashes when deserialize() is called.
As soon as I remove the line of code (where I assign the binaryFormatter.Binder field), the iPhone works perfectly, and (as expected) Unity cannot save and load properly.
Is there something I'm doing wrong? Or should I perform a check if I'm on device and disable the binder? If I should check, what's the convention for checking the platform in C#?
Thank you.
Answer by Michael Stevenson · Apr 08, 2011 at 06:36 PM
SerializationBinder may be attempting to perform JIT compilation at runtime which iOS does not allow. Serialization classes are a minefield for this, I ran into a similar issue when working with XML serialization. I'm afraid I've found no good solution.
You can find platform-dependent compilation instructions here: http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html
Answer by liszto · Aug 20, 2012 at 04:06 PM
Same problem here. I want to the SerializationBinder but I got this exception during program execution : EXC_BAD_ACCESS at first call of VersionDeserializationBinder().
Someone got a solution since Nick's problem or not ?
So I tought I must just write my save data with serialize / deserialize on mobile plateform ?
Last question, Android allow that or it's like iOS ?
Your answer
Follow this Question
Related Questions
Is it possible to serialize and store custom structs on the iPhone in scriptableObjects? 2 Answers
Scriptableobject not saving if i force close the application. 1 Answer
Serializing Custom Objects on IPhone(AoT Problem) 0 Answers
Is there a way to save a procedurally-generated mesh on the client machine? 1 Answer
Serialization errors.. 0 Answers