JSON

2017-10-30  本文已影响0人  _NSString
#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

上一篇下一篇

猜你喜欢

热点阅读