Skip to content

Instantly share code, notes, and snippets.

Created September 21, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c633b6e9e9cb28256b85d78ca98c89aa to your computer and use it in GitHub Desktop.
Save anonymous/c633b6e9e9cb28256b85d78ca98c89aa to your computer and use it in GitHub Desktop.
NSMutableDictionary+Nil
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString * const mama = @"mama";
id value = nil;
NSMutableDictionary *dictionary = [NSMutableDictionary new];
[dictionary setValue:value forKey:mama];
dictionary[mama] = nil;
// fails
[dictionary setObject:value forKey:mama];
NSLog(@"%@", dictionary);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment