marcoarment / FCModel

An alternative to Core Data for people who like having direct SQL access.
MIT License
1.65k stars 173 forks source link

NSInvalidArgumentException - setNilValueForKey #21

Closed mobdim closed 11 years ago

mobdim commented 11 years ago

Hi, If the database value column = NULL, an error occurs "Terminating app due to uncaught exception 'NSInvalidArgumentException', setNilValueForKey : could not set nil as the value".

- (void)decodeFieldValue:(id)value intoPropertyName:(NSString *)propertyName
{
    if (value == [NSNull null]) value = nil;
    if (class_getProperty(self.class, propertyName.UTF8String)) {
        [self setValue:[self unserializedRepresentationOfDatabaseValue:value forPropertyNamed:propertyName] forKeyPath:propertyName];
    }
}

This happens when the value = [NSNull null].

mobdim commented 11 years ago

Ooops. Error in my code. Instead int64_t put NSNumber and everything worked. Thank you.