selector not recognized

xcode报错"selector not recognized",忘记配置:Build Settings--other link -- "-ObjC"

 "-ObjC" 的使用场景

        "An impedance mismatch between UNIX static libraries and the dynamic nature of Objective-C can cause category methods in static libraries to not be linked into an app, resulting in "selector not recognized" exceptions when the methods aren't found at runtime."

"链接器在处理包含Category方法的UNIX的静态库时,没有将Category的方法链接到APP中,造成这个错误"

解决这个错误的方法就是:将Category的方法链接到APP中,这样APP运行时,就能够找到对应的selector。而 –ObjC就可以完成这个任务。

"-ObjC"的作用是:将静态库中任何Objective-C代码都链接到APP中。任何Objective-C代码当然也包括Category的方法。

原文地址:https://www.cnblogs.com/liuting-1204/p/14479772.html