【代码笔记】iOS-json文件的使用

来源:互联网 发布:华为5a切换数据流量 编辑:程序博客网 时间:2024/06/14 19:27

一,工程图。

二,代码。

复制代码
- (void)viewDidLoad {    [super viewDidLoad];    // Do any additional setup after loading the view, typically from a nib.            NSString * datapath = [[NSBundle mainBundle] pathForResource:@"failureReason" ofType:@"json"];    NSData * jsonData = [NSData dataWithContentsOfFile:datapath];    NSMutableDictionary *arrayDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil];    NSLog(@"----arrayDic---%@",arrayDic);    }
复制代码
原创粉丝点击