- func login(mobile:String,passwd:String,responseResult:(result:NSDictionary?,error:(Int8,String)?)->Void) {
- Alamofire.request(.GET,"http://httpbin.org/get",parameters: ["foo": "bar"])
- .responseString { (request,response,string,error) in
- if error != nil {
- responseResult(result: nil,error: (error!.code,error!.localizedDescription))
- } else {
- responseResult(result: nil,error: nil)
- }
- }
- }
- >>>Cannot invoke 'responseResult' with an argument list of type '(result: nil,error: (Int,String))'
这个错误的原因是error!.code是int类型,而声名的是int8类型
- func login(mobile:String,passwd:String,responseResult:(result:NSDictionary?,error:(Int,String)?)->Void)