iOS/Xcode异常:no visible @interface for XXX declares the selector YYY

在iOS/Xcode开发过程中,出现如下异常信息:

no visible @interface for XXX declares the selector YYY

分析原因:

There are lots of reasons it could happen, but generally it’s saying that at the line of code it flags, it doesn’t see any evidence that the selector you are referencing is in the interface of the type it thinks the object has.

有很多原因导致这一情况发生,但是一般而言,发生异常的代码行,指没有在interface接口文件中,找到任何你引用的selector(方法)。

可能的原因:

  • 没有在interface进行声明定义
  • 字母输入错误
  • 参数输入有误或少参数

举例:

server是BulletinBoardClient类对象,其要实现BulletinBoard接口,但是其中的接口方法add和get是有参数的。

 可行修改方法:

原文地址:https://www.cnblogs.com/MakeView660/p/11388207.html