Objc and C ++ are the same OOP languages derived from the C language, but their methods for implementing OOP are different: In C ++, objects and methods are bound to the compiler; in objc, the word "method" is "message ",ProgramSend a message to the object at runtime, that is, binding during runtime.
The two methods have their own advantages and disadvantages. c ++ focuses on performance and objc focuses on flexibility.
However, binding during runtime poses a problem for development-the method name is misspelled during programming and the compiler does not report an error. I tried to debug for one hour and found that the method name contains less colons.
For this reason, I have used a stupid method to assert that an object responds to a method to eliminate the possibility of errors.
This is of course too troublesome. In fact, there is a simple method. The compiler can report the following:
Take xcode 4 as an example. Open a project and double-click the project file in the left-side Navigation Pane:
In the pop-up window, set the GCC Waring item undeclared selector to yes: