0

緯度と経度の場所に基づいて、アプリの気温と天気のデータを取得しようとしています...

どうすればこれを機能させることができますか?

    NSURL *jsonurl = [NSURL URLWithString:@"http://www.myweather2.com/developer/forecast.ashx?uac=(API-KEY)&output=json&query=",placemark.location,@"&temp_unit=f"];
4

1 に答える 1

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 であることを前提としています。

于 2013-01-30T22:08:36.810 に答える