tristanhimmelman/AlamofireObjectMapper

Contextual type for closure argument list expects 1 argument, but 2 were specified

Closed this issue · 2 comments

Hi,

before, I did

let requestBody = Mapper().toJSON(respAddr)

    Alamofire.request(.POST, url,parameters: requestBody,encoding: .JSON)
        .responseObject{(responseBody:Address?,error) in
           ...
    }

it worked but not anymore , why? and how to correct it ?

Hi @zemadara , please see the ReadMe the project has changed lately. Here is an example:

let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/2ee8f34d21e8febfdefb2b3a403f18a43818d70a/sample_keypath_json"
Alamofire.request(.GET, URL).responseObject() { (response: Response<WeatherResponse, NSError>) in

    let weatherResponse = response.result.value
    print(weatherResponse?.location)

    if let threeDayForecast = weatherResponse?.threeDayForecast {
        for forecast in threeDayForecast {
            print(forecast.day)
            print(forecast.temperature)           
        }
    }
}

Thank you