diff --git a/YYModel/NSObject+YYModel.m b/YYModel/NSObject+YYModel.m index 3d7c470..edcbff9 100644 --- a/YYModel/NSObject+YYModel.m +++ b/YYModel/NSObject+YYModel.m @@ -1701,7 +1701,7 @@ - (id)yy_modelInitWithCoder:(NSCoder *)aDecoder { YYEncodingType type = propertyMeta->_type & YYEncodingTypeMask; switch (type) { case YYEncodingTypeObject: { - id value = [aDecoder decodeObjectForKey:propertyMeta->_name]; + id value = [aDecoder decodeObjectOfClass:propertyMeta->_cls forKey:propertyMeta->_name]; ((void (*)(id, SEL, id))(void *) objc_msgSend)((id)self, propertyMeta->_setter, value); } break; case YYEncodingTypeSEL: {