每当我试图通过 xcode 7 中的 JSon 获取数据时,它都会给我错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
在 xcode 6 中它工作正常。是否在 xcode 7 中实现了从 json 获取数据的新方法。
[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139"]];
id response=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];