我試圖讓天氣使用此代碼使用Openweathermap城市空間名稱:獲取城市的天氣與包含使用Openweathermap
func getWeatherByCity(city: String) {
if let weatherRequestURL = NSURL(string: "\(openWeatherMapBaseURL)?APPID=\(openWeatherMapAPIKey)&q=\(city)") {
getWeather(weatherRequestURL: weatherRequestURL)
}
}
的API適用於不含空格的城市名稱。
即使在主頁http://openweathermap.org/,尋找舊金山沒有結果。
這裏缺少什麼?
如果我的答案幫助你,請將它標記爲正確的,謝謝:) –