Created
January 10, 2012 13:25
-
-
Save codeswimmer/1589080 to your computer and use it in GitHub Desktop.
iOS: Log all keys and values from a NSDictionary
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
| -(void)logAllKeys:(NSDictionary *)userInfo | |
| { | |
| NSArray *allKeys = [userInfo allKeys]; | |
| for (NSString *key in allKeys) { | |
| id value = [userInfo valueForKey:key]; | |
| NSString *valueString = @""; | |
| if ([value isKindOfClass:[NSString class]]) | |
| valueString = (NSString *)value; | |
| else if ([value isKindOfClass:[NSNumber class]]) | |
| valueString = [(NSNumber *)value stringValue]; | |
| NSLog(@" %@: %@", key, valueString); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment