美文网首页
闭包问题Cannot convert value of type

闭包问题Cannot convert value of type

作者: 未知的远方 | 来源:发表于2017-06-21 10:41 被阅读161次

今天封装afnet的时候遇到这个问题:Cannot convert value of type '(URLSessionDataTask, Error) -> Void' to expected argument type '((URLSessionDataTask?, Error) -> Void)?'

0图片.png

大概意思就是我写的这个闭包和afnet的类型不同

1图片.png

研究之后改成这样(加了个问号)

图片.png

相关文章

网友评论

      本文标题:闭包问题Cannot convert value of type

      本文链接:https://www.haomeiwen.com/subject/njpzqxtx.html