【发布时间】:2015-09-12 11:28:33
【问题描述】:
使用 Xcode 7.1 使用来自Github 的 AlamofireObjectMapper 框架。我无法使用 responseObject 处理程序。
下面是代码:
let url = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/f583be1121dbc5e9b0381b3017718a70c31054f7/sample_json"
Alamofire.request(.GET, url).responseObject{(response :WeatherResponse?, error: NSError?) -> Void in
print(response?.location)
}
即使我从代码中删除 '-> Void' 也没有区别。 WeatherResponse 是一个自定义类,代码如下:
class WeatherResponse: Mappable {
var location: String?
var threeDayForecast: [Forecast]?
required init?(_ map: Map){
}
func mapping(map: Map) {
location <- map["location"]
threeDayForecast <- map["three_day_forecast"]
}
}
错误:
【问题讨论】:
-
同样的问题?你找到解决办法了吗?