简体   繁体   English

类型 UiViewController 不符合协议 xxx

[英]Type UiViewController does not conform to protocol xxx

I have a delegate method in Objective-C code which need to implement in my project which was earlier in swift 2.3 and worked fine but after upgrading to swift 3.0 it shows error...我在 Objective-C 代码中有一个委托方法,它需要在我的项目中实现,该方法在 swift 2.3 的早期版本中运行良好,但在升级到 swift 3.0 后它显示错误...

Type UiViewController does not conform to protocol xxx类型 UiViewController 不符合协议 xxx

I have tried everything I can think of but it still isn't working.我已经尝试了所有我能想到的方法,但仍然无法正常工作。

function in protocol from Objective-C like UITableViewDataSouce has changed to a more swift style eg:像 UITableViewDataSouce 这样的 Objective-C 协议中的函数已更改为更快速的样式,例如:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell

has change to已更改为

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell just modify to new styled func,the error will be gone func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell 只需修改为新样式的func,错误就会消失

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM