闭包错误-Cannot invoke 'responseResult' with an argument list of type
来源:互联网 发布:雪梨淘宝店叫什么名字 编辑:程序博客网 时间:2024/05/20 11:21
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)
0 0
- 闭包错误-Cannot invoke 'responseResult' with an argument list of type
- Swift*Cannot invoke 'jsonObject' with an argument list of type
- Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForward
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误argument of type "char *" is incompatible with parameter of type "LPCWSTR"的解决方法
- 错误:argument of type "char *" is incompatible with parameter of type "LPCWSTR"
- Cannot invoke org.RentingSystem.entity.House.setPubdate - argument type mismatch
- Cannot initialize a parameter of type 'NSString *_Nullable' with an rvalue of type ''UITouchPhase"
- cannot initialize a parameter of type 'IPCameraNightMode' with an rvalue of type 'int'
- A project with an Output Type of Class Library cannot be started directly
- A project with an Output Type of Class Library cannot be started directly
- A project with an Output Type of Class Library cannot be started directly
- A project with an Output Type of Class Library cannot be started directly的解决
- A project with an Output Type of Class Library cannot be started directly
- Error: A project with an Output Type of Class Library cannot be started directly
- 神马都是浮云,unity中自己写Coroutine协程源码
- C++命名空间
- POJ 2081 Recaman's Sequence(水~)
- html元素解释
- 二维码框架ZBarSDK的使用和自定义二维码扫描界面方法
- 闭包错误-Cannot invoke 'responseResult' with an argument list of type
- Invert Binary Tree
- 软件开发过程学习笔记(一)之软件开发流程
- STL - deque(双端队列)
- iOS 开发 admob 使用报错
- mysql中统计精度问题
- except as a control flow mechanism
- mysql概念解释
- 台大机器学习基石笔记(一)——机器学习可行性