0
최근에 Swift
으로 마이그레이션 했으므로 참을성과지지를 보내 주시기 바랍니다. 내가 Alamofire 4
Alamofire 4의 Swift 3 Alamofire 버전에 대한 ObjectMapper 및 Alamofire 문제
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/d8bb95982be8a11a2308e779bb9a9707ebe42ede/sample_json"
Alamofire.request(URL).response { (response: DataResponse<WeatherResponse>) in
let weatherResponse = response.result.value
print(weatherResponse?.location)
if let threeDayForecast = weatherResponse?.threeDayForecast {
for forecast in threeDayForecast {
print(forecast.day)
print(forecast.temperature)
}
}
}
의 구문을 수정 Object Mapper
github page의 코드를 사용하지만, 스크린 샷과 같이 나는 다음과 같은 오류가 발생합니다. 당신이 Alamofire에서 메서드를 호출해야
올바른 형식을 얻을 수 있도록 도와 주셔서 감사하지만 완성시 응답을 모델링해야합니다. https://github.com/tristanhimmelman/AlamofireObjectMapper –
다음에 데이터를 반환하는 완성 처리기 메서드를 만들어야합니다. 귀하의 형식을 –
같아요 반환 된 자동으로 모델 클래스에 기록됩니다 –