Why does NSString respond to appendString?

前端 未结 3 1959
悲哀的现实
悲哀的现实 2020-12-30 04:11

I was playing with the respondsToSelector method in Objective-C on MacOS-X 10.6.7 and Xcode 4.0.2, to identify if an object would respond to certain messages. According to t

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 04:39

    You should not make assumptions about a method being not there. That method might be used internally or for whatever reason it exists. Technically, it's just private API.

    You only have a contract to the public declarations (docs), and they don't show that message. So be prepared to get into trouble rather quickly if you use other features.

提交回复
热议问题