Created
June 1, 2009 15:14
-
-
Save akio0911/121475 to your computer and use it in GitHub Desktop.
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
#import <Foundation/Foundation.h> | |
int main(int argc, char** argv) { | |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |
id path = [NSString stringWithCString:argv[1] | |
encoding:NSASCIIStringEncoding]; | |
id data = [NSData dataWithContentsOfFile:path]; | |
id plist = [NSPropertyListSerialization | |
propertyListFromData:data | |
mutabilityOption: NSPropertyListMutableContainers | |
format: NULL errorDescription:nil]; | |
id aSet = [NSSet setWithArray:plist]; | |
NSLog(@"1: %@\n", [plist valueForKey:@"division"]); | |
NSLog(@"2: %@\n", [aSet valueForKey:@"division"]); | |
NSLog(@"3: %@\n", [plist valueForKeyPath:@"list.name"]); | |
NSLog(@"4: %@\n", [plist valueForKeyPath:@"list.requests.device"]); | |
[plist setValue:@"10" forKeyPath:@"list.requests.price"]; | |
NSLog(@"5: %@\n", [plist valueForKeyPath:@"list.requests"]); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment