NSNull handling for NSManagedObject properties values
It might be a little easier if you wrap this in a macro: #define NULL_TO_NIL(obj) ({ __typeof__ (obj) __obj = (obj); __obj == [NSNull null] ? nil : obj; }) Then you can write things like fight.winnerID = NULL_TO_NIL([dict objectForKey:@”winner”]); Alternatively you can pre-process your dictionary and replace all NSNulls with nil before even trying … Read more