Reputation: 386
I am using a third party framework containing a category on NSData and having a static method dataUsingBase64String:
in it.
The framework got linked fine and code builds successfully. But I am getting unrecognized selector sent to class
runtime error when this method gets called.
I have also tried adding -ObjC
,-all_load
flags in OTHER_LINKER_FLAGS
of XCode with no luck..
Upvotes: 2
Views: 1487
Reputation: 1
If -Objc does not take effect, you can try to delete your Category from the project and drag it to the project again, and check Target membership.
Upvotes: 0
Reputation: 386
Note: I needed to add framework in this way,
Framework Search Paths instead of adding frameworks to "Linked Frameworks and Libraries" section
Here, somehow the framework was not loaded even after adding-Objc
or -all_load
.
Finally, -framework
in OTHER_LINKER_FLAGS
did the trick for me.
Something about it from manpage,
-framework name[,suffix]
This option tells the linker to search for `name.frame-
work/name' the framework search path. If the optional suffix
is specified the framework is first searched for the name
with the suffix and then without (e.g. look for `name.frame-
work/name_suffix' first, if not there try `name.frame-
work/name').
Upvotes: 1
Reputation: 629
I guess your library is statically linked. A common problem in that is categories are not included or linked. You additionally need to add -all_load to the Other Linker Flags of the target which is using your static library.
Also check the below answers similar to your problem
Answer 1 - NSData Unrecognized selector sent to class
Answer 2 - Objective-C Category Causing unrecognized selector
Answer 3 - "unrecognized selector sent to instance" to a static library despite ObjC flag
I hope this helps
Upvotes: 3