Weather
For iOS SDK v4.9+Get global weather real-time and forecast data in 150,000 cities around the world, including temperature, wind, relative humidity, atmospheric pressure, precipitation, visibility, dew point, cloud cover and other data.
Weather
Interface code (Enum) | Interface | Class |
---|---|---|
INQUIRE_TYPE_WEATHER_NOW | Real-time weather | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_3D | 3-day forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_7D | 7-day forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_10D | 10-day forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_15D | 15-day forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_24H | 24-hour forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_72H | 72-hour forecast | WeatherBaseClass |
INQUIRE_TYPE_WEATHER_168H | 168-hour forecast | WeatherBaseClass |
Request Parameters
If no optional parameters are set, the default value will be used.
location
The city to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI.
appKey
API authentication key, please refer to How To Get Your Key.
For example: appKey=12334567890ABC
lang
Multi-language, default Chinese, if data does not match the language you set, it will return in English or its native language. Language parameter please refer to Language
unit
Set weather data unit, default Metric, unit parameters please refer Unit
Sample Code
QWeatherConfigInstance.publicID = @"publicID";
QWeatherConfigInstance.appKey = @"key";
QWeatherConfigInstance.appType = APP_TYPE_BIZ;
QWeatherConfigInstance.location = @"101010100";
QWeatherConfigInstance.lang = @"";
QWeatherConfigInstance.unit = @"";
[QWeatherConfigInstance weatherWithInquireType:INQUIRE_TYPE_WEATHER_NOW WithSuccess:^(WeatherBaseClass *responseObject) {
NSLog(@"Description->%@",[responseObject description]);
} faileureForError:^(NSError *error) {
NSLog(@"error->%@",error);
}];
Response
Parameters | Description |
---|---|
code |
API status code, please refer to Status Code |
updateTime |
|
fxLink |
Responsive web page of this data, for embedded in website or APP |
now.obsTime |
Observation time |
now.temp |
temperature |
now.feelsLike |
Feels like temperature |
now.icon |
Icon code of weather conditions, free to download weather icons |
now.text |
Weather conditions |
now.wind360 |
Wind direction in azimuth degree |
now.windDir |
Wind direction |
now.windScale |
Wind scale |
now.windSpeed |
Wind speed, KM/H |
now.humidity |
Relative humidity in percent |
now.precip |
Accumulated precipitation in the current hour |
now.pressure |
Atmospheric pressure, hPa |
now.vis |
Visibility, KM |
now.cloud |
Cloud cover in percent, may be null |
now.dew |
Dew point temperature, may be null |
daily.fxDate |
Forecast date |
daily.sunrise |
Sunrise time |
daily.sunset |
Sunset time |
daily.moonrise |
Moonrise time |
daily.moonset |
Moonset time |
daily.moonPhase |
Moon phase name |
daily.moonPhaseIcon |
Icon code for moon phase, free to download QWeather Icons |
daily.tempMax |
The highest temperature of the day |
daily.tempMin |
The lowest temperature of the day |
daily.iconDay |
Icon code for daytime weather conditions, free to download weather icons |
daily.textDay |
Weather conditions for daytime |
daily.iconNight |
Icon codes for night weather conditions, free to download weather icons |
daily.textNight |
Weather conditions for night |
daily.wind360Day |
Daytime wind direction in azimuth degree |
daily.windDirDay |
Daytime wind direction |
daily.windScaleDay |
Daytime wind scale |
daily.windSpeedDay |
Daytime wind speed, KM/H |
daily.wind360Night |
Nightly wind direction in azimuth degree |
daily.windDirNight |
Nightly Wind direction |
daily.windScaleNight |
Nightly wind scale |
daily.windSpeedNight |
Nightly wind speed, KM/H |
daily.precip |
Estimated total precipitation for the day |
daily.uvIndex |
UV index |
daily.humidity |
Relative humidity in percent |
daily.pressure |
Atmospheric pressure, hPa |
daily.vis |
Visibility, KM |
daily.cloud |
Cloud cover in percent, may be null |
hourly.fxTime |
Forecast time |
hourly.temp |
temperature |
hourly.icon |
Icon code of weather conditions, free to download weather icons |
hourly.text |
Weather conditions |
hourly.wind360 |
Wind direction in azimuth degree |
hourly.windDir |
Wind direction |
hourly.windScale |
Wind scale |
hourly.windSpeed |
Wind speed, KM/H |
hourly.humidity |
Relative humidity in percent |
hourly.precip |
Accumulated precipitation in the current hour |
hourly.pop |
Precipitation probability in percent, may be null |
hourly.pressure |
Atmospheric pressure, hPa |
hourly.cloud |
Cloud cover in percent, may be null |
hourly.dew |
Dew point temperature, may be null |
refer.sources |
Data source and other statements, may be null |
refer.license |
Data license, may be null |
Minutely Precipitation
Interface code (Enum) | Interface | Class |
---|---|---|
INQUIRE_TYPE_WEATHER_MINUTELY | Minute precipitation | WeatherMinutelyBaseClass |
Request Parameters
location
The comma-separated longitude and latitude (decimal, up to 2 decimal places) of the location to be queried.
For example: location=116.41,39.92
appKey
API authentication key, please refer to How To Get Your Key.
For example: appKey=12334567890ABC
lang
Multi-language setting, default Chinese, only support Chinese and English for this data. Language parameter please refer to Language
Sample Code
QWeatherConfigInstance.publicID = @"publicID";
QWeatherConfigInstance.appKey = @"key";
QWeatherConfigInstance.appType = APP_TYPE_BIZ;
QWeatherConfigInstance.location = @"116.41,39.92";
QWeatherConfigInstance.lang = @"";
[QWeatherConfigInstance weatherWithInquireType: INQUIRE_TYPE_WEATHER_MINUTELY WithSuccess:^(WeatherMinutelyBaseClass *responseObject) {
NSLog(@"Description->%@",[responseObject description]);
} faileureForError:^(NSError *error) {
NSLog(@"error->%@",error);
}];
Response
Parameters | Description |
---|---|
code |
API status code, please refer to Status Code |
updateTime |
|
fxLink |
Responsive web page of this data, for embedded in website or APP |
summary |
Precipitation description |
minutely.fxTime |
Forecast time |
minutely.precip |
Accumulated precipitation in 10 minutes, unit is millimeter. |
minutely.type |
Type of precipitation |
refer.sources |
Data source and other statements, may be null |
refer.license |
Data license, may be null |