Skip to content

Instantly share code, notes, and snippets.

@leontiy
Created November 22, 2009 15:35
Show Gist options
  • Save leontiy/240607 to your computer and use it in GitHub Desktop.
Save leontiy/240607 to your computer and use it in GitHub Desktop.
NSString * path = [[NSBundle mainBundle] pathForResource:<#Resource name#> ofType:@"plist"];
NSData * plistXML = [[NSFileManager defaultManager] contentsAtPath: path];
NSString * errorDesc = nil;
NSPropertyListFormat format;
<#Variable name#> = (<#Type of top level element#> *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorDesc];
if (nil == <#Variable name#>) {
NSLog(@"Can not load <#What#>.");
if (errorDesc) {
NSLog(@"Error description: %@", errorDesc);
[errorDesc release]; errorDesc = nil;
}
<#more error handling#>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment