Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "NSArray+Plist.h"
- @implementation NSArray (Plist)
- + (id)arrayFromPlist:(NSString *)filename {
- NSData *plistData;
- NSString *error;
- NSPropertyListFormat format;
- id plist;
- NSString *localizedPath = [[NSBundle mainBundle] pathForResource:filename ofType:@"plist"];
- plistData = [NSData dataWithContentsOfFile:localizedPath];
- plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
- if (!plist) {
- NSLog(@"Error reading plist from file '%s', error = '%s'", [localizedPath UTF8String], [error UTF8String]);
- [error release];
- }
- return plist;
- }
- @end
Add Comment
Please, Sign In to add comment