-
-
Save mdippery/48e3ad94ac3a7fdc2627 to your computer and use it in GitHub Desktop.
Non-string keys in NSDictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, char **argv) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSNumber *key = [NSNumber numberWithInteger:10]; | |
NSString *val = @"Ten"; | |
NSMutableDictionary *d = [NSMutableDictionary dictionary]; | |
[d setObject:val forKey:key]; // This will compile fine | |
[d setValue:val forKey:key]; // This will cause a compiler error | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment