Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Merge pull request #117 from rohan-panchal/64bit-fix
Browse files Browse the repository at this point in the history
Altered attribute type checking for different Integer and float types
  • Loading branch information
stephencelis committed Jun 17, 2015
2 parents 53ecad9 + 5b16639 commit 7e09446
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/NSManagedObject+ActiveRecord.m
Expand Up @@ -367,12 +367,12 @@ - (void)setSafeValue:(id)value forKey:(NSString *)key {
else if ([value isKindOfClass:[NSString class]]) {

if ([self isIntegerAttributeType:attributeType])
value = [NSNumber numberWithInteger:[value integerValue]];
value = [NSNumber numberWithLongLong:[value longLongValue]];

else if (attributeType == NSBooleanAttributeType)
value = [NSNumber numberWithBool:[value boolValue]];

else if (attributeType == NSFloatAttributeType)
else if ([self isFloatAttributeType:attributeType])
value = [NSNumber numberWithDouble:[value doubleValue]];

else if (attributeType == NSDateAttributeType)
Expand All @@ -388,6 +388,11 @@ - (BOOL)isIntegerAttributeType:(NSAttributeType)attributeType {
(attributeType == NSInteger64AttributeType);
}

- (BOOL)isFloatAttributeType:(NSAttributeType)attributeType {
return (attributeType == NSFloatAttributeType) ||
(attributeType == NSDoubleAttributeType);
}

#pragma mark - Date Formatting

- (NSDateFormatter *)defaultFormatter {
Expand Down

0 comments on commit 7e09446

Please sign in to comment.