Created
March 19, 2010 16:57
-
-
Save searls/337818 to your computer and use it in GitHub Desktop.
Looks like the simulator and device evaluate parameters in a different order
This file contains hidden or 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
NSUInteger uid = 0; | |
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; | |
[dictionary setObject:[NSNumber numberWithInt:uid++] forKey:[NSNumber numberWithInt:uid]]; | |
NSNumber *result = [dictionary objectForKey:[NSNumber numberWithInt:1]]; | |
NSLog(@"Result: %@",result); | |
//device: 2010-03-19 12:51:31.938 Sandbox[568:207] Result: 0 | |
//simulator: 2010-03-19 12:50:24.281 Sandbox[6594:207] Result: (null) | |
uid = 0; | |
dictionary = [NSMutableDictionary dictionary]; | |
[dictionary setObject:[NSNumber numberWithInt:++uid] forKey:[NSNumber numberWithInt:uid]]; | |
result = [dictionary objectForKey:[NSNumber numberWithInt:1]]; | |
NSLog(@"Result: %@",result); | |
//device: 2010-03-19 12:52:54.911 Sandbox[583:207] Result: 1 | |
//simulator: 2010-03-19 12:53:19.826 Sandbox[6829:207] Result: (null) | |
uid = 0; | |
dictionary = [NSMutableDictionary dictionary]; | |
uid++; | |
[dictionary setObject:[NSNumber numberWithInt:uid] forKey:[NSNumber numberWithInt:uid]]; | |
result = [dictionary objectForKey:[NSNumber numberWithInt:1]]; | |
NSLog(@"Result: %@",result); | |
//device: 2010-03-19 12:55:30.358 Sandbox[598:207] Result: 1 | |
//simulator: 2010-03-19 12:54:29.667 Sandbox[6937:207] Result: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment