【发布时间】:2015-05-12 06:03:15
【问题描述】:
我正在尝试使用此代码从 geojson 文件中读取数据:
NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"roads_json" ofType:@"geojson"];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:[[NSData alloc]
initWithContentsOfFile:jsonPath]
options:0
error:nil];
NSLog(@"points:%@",json);
和输出:
点数:(null)
任何想法请...
【问题讨论】:
-
你能把geoJSON文件的内容贴出来吗?
-
您确定文件包含正确的 json 格式吗...您是否在控制台中收到任何错误...
-
@vizllx 是的,包含正确的 json 格式并且控制台中没有错误...
-
你没有传递错误对象,你怎么知道有没有错误?
-
jsonPath 设置是否正确,您尝试过记录吗?
标签: ios objective-c geojson