I wrote a category just for dealing with this issue. I used it with Core Data but it should help you, too.
@interface NSDictionary (Extensions)
- (id)NSNullToNilForKey:(NSString *)key;
@end
@implementation NSDictionary (Extensions)
- (id)NSNullToNilForKey:(NSString *)key
{
id value = [self valueForKey:key];
return value != [NSNull null] ? value : nil;
}
@end
Sample use:
NSString *value = [dictionary NSNullToNilForKey:@"key"];