Swift Alamofire库无效不能转换为响应<;任意对象,N错误>-&燃气轮机;空虚

Swift Alamofire库无效不能转换为响应<;任意对象,N错误>-&燃气轮机;空虚,swift,alamofire,Swift,Alamofire,我有一个将JSON结果设置到NSDictionary中的函数。然后,它使用该值调用一些其他函数。我正在使用Alamofire,自从我在Swift 1中编写了这个应用程序以来,有些情况发生了变化,这给了我错误 以下是函数: func fetchApiData() { // I believe this is the problem code below. let _requestURL1 = Alamofire.request(.GET,dataSource

我有一个将JSON结果设置到NSDictionary中的函数。然后,它使用该值调用一些其他函数。我正在使用Alamofire,自从我在Swift 1中编写了这个应用程序以来,有些情况发生了变化,这给了我错误

以下是函数:

func fetchApiData() {


    // I believe this is the problem code below.


            let _requestURL1 = Alamofire.request(.GET,dataSourceURL!)
    _requestURL1.responseJSON { (_requestUrl, _requestResponse, _objJSON1, error) -> Void in
        if(_objJSON1 != nil)
        {
            let jsonResult1 = _objJSON1 as NSDictionary;
            self.checkIP(jsonResult1)
            self.checkGeo(jsonResult1)
        }
        else{
            return
        }
    }
        let _requestURL2 = Alamofire.request(.GET,self.dataSourceURL2!)
        _requestURL2.responseJSON { (_requestUrl, _requestResponse, _objJSON2, error) -> Void in
            if(_objJSON2 != nil)
            {
                let jsonResult2 = _objJSON2 as NSDictionary;
                self.checkDNS(jsonResult2)
                NSTimer.scheduledTimerWithTimeInterval(self.refreshFrequencyInt, target: self, selector: Selector("fetchApiData"), userInfo: nil, repeats: false)
            }
            else{
                return
            }
        }
    }
显然现在,这一行:

    _requestURL1.responseJSON { (_requestUrl, _requestResponse, _objJSON1, error) -> Void in
给我这个错误:

'(_, _, _, _) -> Void' is not convertible to 'Response<AnyObject, NSError> -> Void'
”(,,,,,,->Void)不能转换为“Response->Void”
我已经尝试过解决这个问题的方法,但我似乎无法让代码以与以前相同的方式工作

请帮忙!:)

试试这个:

       Alamofire.request(.GET, url)
        .responseJSON(completionHandler: {
        (JSON) -> Void in
            let JSONDictonary = JSON.result.value as! NSDictionary
           let photoInfos = (JSONDictonary.valueForKey("photos") as! [NSDictionary]).filter({
                ($0["nsfw"] as! Bool) == false
            }).map{
                PhotoInfo(id: $0["id"] as! Int, url: $0["image_url"] as! String)
            }