swfit 4 的新特性
今天编译代码发现了这个问题,查了下,修正很简单在相关类前加:
@objcmembersclass JKWLoginVC: UIVIEwController {}
或者在方法名前做修改
@objc func clickLoginBtn() { }
As of Swift 4 you’ll start seeing the error “Argument of ‘#selector’ refers to instance method ‘firstPage()’ that is not exposed to Objective-C”,along with the proposed fix of “Add ‘@objc’ to expose this instance method to Objective-C”. What this means is that the Swift method in question isn’t visible to Objective-C,which matters because UIbarbuttonItem is Objective-C code.
While adding @objc to indivIDual methods is a working solution,I expect most people will just shrug their shoulders and put @objcmembers before their class – that automatically exposes everything in the class to Objective-C,just like Swift 3 used to. So,modify the class deFinition to this:
总结以上是内存溢出为你收集整理的Swift 4.0 报错:Argument of '#selector' refers to instance method xxx全部内容,希望文章能够帮你解决Swift 4.0 报错:Argument of '#selector' refers to instance method xxx所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)