首页 > 代码库 > Plist文件读取
Plist文件读取
+ (NSDictionary *)readFromArchive:(NSString *)aFileName {
NSString *errorDesc = nil;
NSPropertyListFormat format;
NSString *plistPath = [[NSBundle mainBundle] pathForResource:aFileName
ofType:@"plist"];
NSData *plistXML = [[NSFileManager defaultManager]
contentsAtPath:plistPath];
NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:plistXML
mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:&format errorDescription:&errorDesc];
if (!temp) {
NSLog(@"%s at line %d with message: %@", __FUNCTION__, __LINE__, errorDesc);
}
return temp;
}
本文出自 “深圳市联城通科技公司” 博客,请务必保留此出处http://roderickkennedy.blog.51cto.com/6758427/1579697
Plist文件读取