方法一:
//通過指定路徑讀取
NSError *error = nil;
NSString *filePath = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"test" ofType:@"json"] encoding:NSUTF8StringEncoding error:&error];
NSLog(@"filePath%@",filePath);
方法二:
//指定路徑讀取
NSString *filePath=[[NSBundle mainBundle] pathForResource:@"test"ofType:@"json"];
NSString *str=[[NSString alloc] initWithContentsOfFile:filePath];
NSLog(@"%@",str);