当更新项目代码到swift 4得到一些错误的add.target方法 我该如何解决这个错误?如何更新addTarget方法swift 4
//swift3
var chatLogController: ChatLogController? {
didSet {
sendButton.addTarget(chatLogController, action: #selector(ChatLogController.handleSend), for: .touchUpInside)
uploadImageView.addGestureRecognizer(UITapGestureRecognizer(target: chatLogController, action: #selector(ChatLogController.handleUploadTap)))
}
}
“得到一些错误”获取_what_错误? – matt
这个错误“#selector'的参数是指实例方法'handleSend()'没有公开到Objective-C” –
那么你的答案。只要阅读错误信息说的是什么!把'@ objc'放在'func handleSend ...'前面(你甚至没有在你的问题中显示,看在上帝的份上)。 – matt