diff --git a/Source/API/CBLModel+Properties.m b/Source/API/CBLModel+Properties.m index 62e1290dd..5953d4ddc 100644 --- a/Source/API/CBLModel+Properties.m +++ b/Source/API/CBLModel+Properties.m @@ -238,7 +238,12 @@ + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClas return [receiver getArrayRelationProperty: property withModelClass: itemClass]; }; } - } else { + } + else if ( [itemClass isSubclassOfClass: [NSObject class]] && ![itemClass isSubclassOfClass:[NSDate class]]) + { + return [super impForGetterOfProperty: property ofClass: propertyClass]; + } + else { // Typed array of scalar class: ValueConverter itemConverter = valueConverterToClass(itemClass); if (itemConverter) { @@ -253,7 +258,12 @@ + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClas impBlock = ^id(CBLModel* receiver) { return [receiver getModelProperty: property]; }; - } else { + } + else if ( [propertyClass isSubclassOfClass: [NSObject class]] && ![propertyClass isSubclassOfClass:[NSDate class]]) + { + return [super impForGetterOfProperty: property ofClass: propertyClass]; + } + else { // Other property type -- use a ValueConverter if we have one: ValueConverter converter = valueConverterToClass(propertyClass); if (converter) { @@ -300,7 +310,13 @@ + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClas } [receiver setValue: value ofProperty: property]; }; - } else { + } + else if ([propertyClass isSubclassOfClass: [NSObject class]]) + { + return [super impForSetterOfProperty: property ofClass: propertyClass]; + } + + else { // Scalar-valued array: impBlock = ^(CBLModel* receiver, NSArray* value) { [receiver setValue: value ofProperty: property]; @@ -316,7 +332,12 @@ + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClas } [receiver setValue: value ofProperty: property]; }; - } else { + } + else if ([propertyClass isSubclassOfClass: [NSObject class]]) + { + return [super impForSetterOfProperty: property ofClass: propertyClass]; + } + else { return [super impForSetterOfProperty: property ofClass: propertyClass]; }