From 9337cf4bc690028915576fcf941c9b2675412f79 Mon Sep 17 00:00:00 2001 From: Vasiliy Yatsevich Date: Mon, 19 Oct 2015 18:14:41 +0300 Subject: [PATCH] Null objects don't add to realm, if that chash it --- Realm+JSON/RLMObject+JSON.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Realm+JSON/RLMObject+JSON.m b/Realm+JSON/RLMObject+JSON.m index 806d812..75f8796 100644 --- a/Realm+JSON/RLMObject+JSON.m +++ b/Realm+JSON/RLMObject+JSON.m @@ -195,6 +195,16 @@ + (id)mc_createObjectFromJSONDictionary:(NSDictionary *)dictionary { if ([objectKeyPath isEqualToString:@"self"]) { return value; } + + if ([value isEqual:[NSNull null]]) { + if ([propertyClass isSubclassOfClass:[NSObject class]]) { + if ([NSString class] == propertyClass || [NSDate class] == propertyClass) { + continue; + } + } else { + continue; + } + } NSArray *keyPathComponents = [objectKeyPath componentsSeparatedByString:@"."]; id currentDictionary = result;