
// Can't see this at all@interface NSThing- (voID)secretMethod;@end
我有一个类别:
@interface NSThing (Helpers)- (voID)secretMethod;@end
这会覆盖Apple的实现吗?他们的其他私有方法是否会开始调用我的实现?
解决方法 从 “Avoid Category Method Name Clashes”开始:If the name of a method declared in a category is the same as a method
in the original class,or a method in another category on the same
class (or even a superclass),the behavior is undefined as to which
method implementation is used at runtime. This is less likely to be an
issue if you’re using categorIEs with your own classes,but can cause
problems when using categorIEs to add methods to standard Cocoa or
Cocoa touch classes.
因此,如果您“意外”实现了与其名称相同的类别方法
现有方法(私有或非私有),行为未定义.
因此,您应该在类别方法前面加上前缀姓名冲突不太可能.
总结以上是内存溢出为你收集整理的ios – 如果我不小心覆盖了Apple的私有API,会发生什么?全部内容,希望文章能够帮你解决ios – 如果我不小心覆盖了Apple的私有API,会发生什么?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)