|
So I'm trying to serialize some data including enums on iOS, but I keep hitting a wall. Here's the offending code: Seems like it should be pretty cut-and-dry, no? Not so fast! Mono relies on JIT compilation to serialize Enums, and iOS WILL NOT JIT! I get this error while trying to serialize an instance of GameData: Okay, to me this suggests two possible workarounds.
Problem with option 1 is that using TypeMetadata seems to be rather poorly documented. It is certainly possible, but I haven't the slightest idea how to do it. Problem with option 2 is... well it just plain doesn't make a difference for some reason. Have a look at the modified code: ...and here's the accompanying error: In case you're wondering, yes, this is the same error as before. Why does MonoTouch think I'm still trying to serialize Ranks?! I'm quite clearly serializing ints!
(comments are locked)
|
|
I am also having the same problem, although i didn't try to serialize enums in my code :( Does anybody have any clue with this problem ? I seems to keep hitting on walls...
(comments are locked)
|

which line is the error? the cast maybe? indeed very weird, because i already serialized enums, although with the xmlserializer. Did you test for a single enum (not array), too?
also, why do you need this custom serialization. i think you can just use the Serializable attribute on all types you want to (de)serialize and let the serializer do all the work for you.