logo头像

小玉的技术博客

iOS读取文件方法

读取json文件

1
2
NSData *JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"queryRecordResult" ofType:@"json"]];
NSDictionary * paraseData = [NSJSONSerialization JSONObjectWithData:JSONData options:NSJSONReadingAllowFragments error:nil];

读取plist文件

1
2
NSString * plistPath = [[NSBundle mainBundle] pathForResource:@"moduleMap" ofType:@"plist"];
NSDictionary * moduleDict = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
支付宝打赏 微信打赏

赞赏是不耍流氓的鼓励