QUITE:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *filePath = @"quite.plist";
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSArray *array = [[NSArray alloc] initWithContentsOfFile:filePath];
NSDictionary *dict = [array objectAtIndex:0];
NSNumber *firstName = [dict objectForKey:@"firstName"];
NSNumber *lastName = [dict objectForKey:@"lastName"];
BOOL first = [firstName boolValue];
BOOL last = [lastName boolValue];
NSLog(@"firstName = %@", first ? @"true" : @"false");
NSLog(@"lastName = %@", last ? @"true" : @"false");
[array release];
} else {
NSLog(@"%@ not found at %@", filePath, [[NSFileManager defaultManager] currentDirectoryPath]);
}
[pool drain];
return 0;
}
Running…
2010-01-28 19:34:38.955 PList[7633:a0f] firstName = false
2010-01-28 19:34:38.958 PList[7633:a0f] lastName = true