大家好,我一直在网上搜索,但运气不佳,但我试图绕过 Alamofires 的异步性质。我正在尝试将 JSON 响应作为字典返回,但 Xcode 给了我“字典不可转换为 'Void'”
func homePageDetails(userName:String) -> (Dictionary<String,AnyObject>){
let username = userName
let hompePageDetails = Alamofire.request(.GET, "http://example.com/API/Bunch/GetHomePageDetails/\(username)/").responseJSON{(request, response, JSON, error) in
print(JSON)
var test = JSON as Dictionary<String,AnyObject>
return test
}
}
任何帮助将不胜感激。