JSON

作者: _NSString | 来源:发表于2017-10-30 18:04 被阅读0次
#import "ViewController.h"

@interface ViewController ()

{
    NSDictionary *dic;
}


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSString *path = [[NSBundle mainBundle]pathForResource:@"Data" ofType:@"json"];
    
    NSData *dataJson = [NSData dataWithContentsOfFile:path];
    
    dic = [NSJSONSerialization JSONObjectWithData:dataJson options:NSJSONReadingMutableContainers error:nil];;
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    NSLog(@"dataJson =%@",dic);
    
}



@end

相关文章

网友评论

      本文标题:JSON

      本文链接:https://www.haomeiwen.com/subject/gvrmpxtx.html