我正在尝试根据纬度和经度位置获取应用的临时和天气数据......
我怎样才能让它发挥作用?
NSURL *jsonurl = [NSURL URLWithString:@"http://www.myweather2.com/developer/forecast.ashx?uac=(API-KEY)&output=json&query=",placemark.location,@"&temp_unit=f"];
答案 0 :(得分:1)
NSString *jsonStr = [NSString stringWithFormat:@"http://www.myweather2.com/developer/forecast.ashx?uac=(API-KEY)&output=json&query=%@&temp_unit=f", placemark.location];
NSURL *jsonurl = [NSURL URLWithString:jsonStr];
这假设placemark.location
的值是仅包含有效URL字符的NSString。