为了账号安全,请及时绑定邮箱和手机立即绑定

failure里的operation报错

let manager = AFHTTPRequestOperationManager()

        let url = "http://api.openweathermap.org/data/2.5/weather"

        let params = ["lat": latitude, "long": longitude, "cnt": 0]

        manager.GET(url,

            parameters: params,

            success: { (operation:AFHTTPRequestOperation!,

                responseObject: AnyObject!) in

                print("JSON: " + responseObject.description!)

            },

            failure: { (operation:AFHTTPRequestOperation!,

                error: NSError!) in

                print("Error: " + error.localizedDescription)

        })

failure里提示/Users/enchanterzero/Desktop/1/Weather/Weather/ViewController.swift:52:22: Cannot convert value of type '(AFHTTPRequestOperation!, NSError!) -> _' to expected argument type '((AFHTTPRequestOperation?, NSError) -> Void)?'


正在回答

1 回答

你改成她提示的那样试试看 改成这个((AFHTTPRequestOperation?, NSError) -> Void)?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Swift Weather APP
  • 参与学习       35565    人
  • 解答问题       241    个

本课程将带领大家使用Swift语言开发一个完整的天气 iOS APP

进入课程

failure里的operation报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信