A: If you're seeing a "selector not recognized" runtime exception when calling a category method that is implemented in a static library, you are hitting the link-time build issue described here, and need to add the -ObjC linker flag to your project, by following these steps:
In Xcode, choose View > Navigators > Show Project Navigator, or press <code>⌘1</code>.
Select your project under the PROJECT heading in the Project Navigator, then select the Build Settings tab.
Scroll down to the Other Linker Flags build setting under the Linking collection, or type "Other Linker Flags" into the search bar.
Set the value of the Other Linker Flags build setting to <code>$(OTHER_LDFLAGS) -ObjC</code>.
Figure 1 Modifying the Other Linker Flags build setting

If adding the <code>-ObjC</code> flag isn't fixing the problem, double check that a conflicting Target build setting is not overriding it, by following the above steps, but selecting the current target under "TARGETS" in step 2, instead of the project.
The most common causes of a "selector not recognized" exception are:
The method really does not exist. Check your spelling. Check documentation to verify that the method exists on the version of the operating system your app is using.
Your app is trying to use an object after it has been deallocated, use the Zombies instrument to debug this kind of problem. You are seeing "selector not recognized" because the memory has been re-allocated as a different kind of object.
An impedance mismatch between UNIX static libraries and the dynamic nature of Objective-C can cause category methods in static libraries to not be linked into an app, resulting in "selector not recognized" exceptions when the methods aren't found at runtime.
When a C program is compiled, each "source file" is turned into an "object file" that contains executable functions and static data. The linker glues these object files together into a final executable. That executable is eventually bundled into an app by Xcode.
When a source file uses something (like a function) defined in another file, then an undefined symbol is written into the object file, to "stand in" for the missing thing. The linker resolves these symbols by pulling in the object files that include definitions of undefined symbols when building the final executable.
For example, if <code>main.c</code> uses the function <code>foo()</code>, where <code>foo</code> is defined in another file, <code>B.c</code>, then the object file <code>main.o</code> will have an unresolved symbol for <code>foo()</code>, and <code>B.o</code> will include an implementation of <code>foo()</code>. At link time, <code>B.o</code> will be brought into the final executable, so that the code in <code>main.o</code> now references the implementation of <code>foo()</code> defined in <code>B.o</code>.
A UNIX static library is just a collection of object files. Normally the linker only pulls in an object file from a static library if doing so would resolve some undefined symbol. Not pulling in all object files reduces the size of the final executable.
The dynamic nature of Objective-C complicates things slightly. Because the code that implements a method is not determined until the method is actually called, Objective-C does not define linker symbols for methods. Linker symbols are only defined for classes.
For example, if main.m includes the code <code>[[FooClass alloc] initWithBar:nil];</code> then <code>main.o</code> will contain an undefined symbol for <code>FooClass</code>, but no linker symbols for the <code>-initWithBar:</code>method will be in <code>main.o</code>.
Since categories are a collection of methods, using a category's method does not generate an undefined symbol. This means the linker does not know to load an object file defining the category, if the class itself is already defined. This causes the same "selector not recognized" runtime exception you would see for any unimplemented method.
Passing the <code>-ObjC</code> option to the linker causes it to load all members of static libraries that implement any Objective-C class or category. This will pickup any category method implementations. But it can make the resulting executable larger, and may pickup unnecessary objects. For this reason it is not on by default.
------------------越是喧嚣的世界,越需要甯靜的思考------------------
合抱之木,生于毫末;九層之台,起于壘土;千裡之行,始于足下。
積土成山,風雨興焉;積水成淵,蛟龍生焉;積善成德,而神明自得,聖心備焉。故不積跬步,無以至千裡;不積小流,無以成江海。骐骥一躍,不能十步;驽馬十駕,功在不舍。锲而舍之,朽木不折;锲而不舍,金石可镂。蚓無爪牙之利,筋骨之強,上食埃土,下飲黃泉,用心一也。蟹六跪而二螯,非蛇鳝之穴無可寄托者,用心躁也。