“`html
pod 'CWBOpenDataClient'
“`
“`html
#import
“`
“`html
CWBOpenDataClient *client = [CWBOpenDataClient sharedClient];
“`
“`html
[client fetchWeatherObservationsWithCompletion:^(NSArray
if (error) {
// Handle the error
} else {
// Process the array of observations
}
}];
“`
“`html
[client fetchWeatherForecastsForLocation:@"Taipei" completion:^(NSArray
if (error) {
// Handle the error
} else {
// Process the array of forecasts
}
}];
“`
“`html
CWBObservation *observation = observations[0];
NSString *locationName = observation.locationName;
CWBForecast *forecast = forecasts[0];
NSString *weatherDescription = forecast.weatherDescription;
“`
“`html
[client fetchWeatherObservationsWithCompletion:^(NSArray
if (error) {
NSLog(@"Error occurred: %@", error.localizedDescription);
} else {
// Process the array of observations
}
}];
“`
“`html
CWBOpenDataClient *client = [CWBOpenDataClient sharedClient];
client.baseURL = [NSURL URLWithString:@"https://custom-base-url.com"];
client.requestTimeout = 30.0;
[client setValue:@"Custom Value" forRequestHeader:@"Custom-Header"];
“`