且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Mac OS的Objective C中遇到类扩展问题.收到错误"NSInvalidArgumentException",没有可见的@interface声明选择器

更新时间:2023-01-05 09:16:53

哦.

您将无法从类实现的外部调用该方法..m文件中的类扩展名中的重写属性不会将其公开.至少不是编译器.

You will not be able to call that method from OUTSIDE of your class implementation. Overriding properties in class extensions in the .m file doesn't expose that to the world. At least not to the compiler.

这就是重点.当您希望对对象外部的世界具有只读属性,但对于对象内部的属性仍希望可以方便地执行操作时,此属性适用.

That's the whole point. It's for when you want properties that are readonly to the world outside of that object, but internally to the object you still want to be able to conveniently do things.