Simperium/simperium-ios — pull request #278 by jphribovsek (2014-05-28 15:26:35+00:00)
Title: Prevent type mismatch crashes when syncing in

The approach I followed is to update the attribute values in core data only if:
- the property does exist on the managed object subclass
- the property type matches the incoming attributes type

If not, the attribute is just not updated.
Longer term, an option to cancel the entire sync in transaction, rather than not setting the problematic attributes, would be a better solution, but seems to require major refactoring

This approach assumes that:
- managed object subclasses are generated for each entity being synced
- transformable attributes have a property type in the managed object subclass definition rather 'id'

Note that the type mismatch assertions are still kicking in before this code is executed; this is just meant to be a safeguard in production when assertions are disabled, to prevent an unrecoverable crash at startup.