Debugging exception thrown in Objective-C and Xcode

前端 未结 5 858
梦毁少年i
梦毁少年i 2020-12-23 15:22

I am a long time Microsoft developer and I am new to iPhone development using Xcode. So, I am reading a book and going through examples trying to teach myself how to write

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 15:57

    The reason it's not a compilation error, is because it's perfectly valid to send a message not known at compile time to any object (and any object can be configured to handle messages dynamically as well). All method calls are really messages being sent to objects.

    In general, if you see any warnings you should address them, as in most cases they can lead to problems (as you saw). The misleading aspect is here is that if you compile a file once and it has only warnings, if you compile other classes without making changes to the class that has warnings, the warning will not show in the compiler messages. So every now and then you may want to "clean all targets" and build again to make sure you didn't miss any warnings.

提交回复
热议问题