AFWeather 1.0.1

AFWeather 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2015

Maintained by Alvaro Franco.




AFWeather 1.0.1

alt text

Getting the weather forecast never has been so easy and it supports 5 different services. It returns the raw json so you can easily get the data you need.

alt text

Installation

AFWeather is available on CocoaPods so you can get it by adding this line to your Podfile:

pod 'AFWeather', '~> 1.0'

If you don't use CocoaPods, you will have to import these files into your project:

AFWeather.h
AFWeather.m

Services supported

Service name Place name/Zip code Coordinates AFWeather name
World Weather Online :white_check_mark: :white_check_mark: AFWeatherAPIWorldWeatherOnline
Weather Undeground :white_check_mark: :no_entry_sign: AFWeatherAPIWeatherUnderground
Open Weather Map :white_check_mark: :white_check_mark: AFWeatherAPIOpenWeatherMap
AccuWeather :white_check_mark: :no_entry_sign: AFWeatherAPIAccuWeather
Forecast.io :no_entry_sign: :white_check_mark: AFWeatherAPIForecast

Usage

First of all, make sure that you have imported the main class into the class where you are going to play audio.

#import "AFWeather.h"

Configuring the client

In order to make AFWeather know what service are you using and what's your API key, use the method -configureClientWithService:withAPIKey:. Example:

[[AFWeather sharedClient]configureClientWithService:AFWeatherAPIForecast withAPIKey:@"myawesomeapikey"];

Getting the forecast from a city name or Zip code

For this, use -fetchForecastOfLocationWithName:andCompletionBlock:

Example:

    [[AFWeather sharedClient]fetchForecastOfLocationWithName:@"Murcia" andCompletionBlock:^(NSDictionary *response, NSError *error) {

        if (!error) {

            // Handle the response dictionary with all the information

        } else {

            //Handle the error
        }
    }];

Getting the forecast from the coordinates

You can also use the latitude and the longitude instead of the place name.

    [[AFWeather sharedClient]fetchForecastOfLocationWithLatitude:@"121.518446" andLogitude:@"-26.181156" andCompletionBlock:^(NSDictionary *response, NSError *error) {

        if (!error) {

            // Handle the response dictionary with all the information

        } else {

            //Handle the error
        }
    }];

License

AFWeather is under MIT license so feel free to use it!

Author

Made by Alvaro Franco. If you have any question, feel free to drop me a line at [email protected]