Reputation: 130
I am facing some issues on the last two days and I didn't find anything on Internet that help me to solve them.
Here's the problem:
During the last two days, I have tried the followings:
One thing that is very weird is that I have print the methods available in my frameworks in both projects according to this Stack Overflow, in the first project I have 130 methods available, in the second one I have only 72 methods available.
Is anyone have a clue of what happen?
Regards,
Jeremy
Upvotes: 0
Views: 348
Reputation: 421
sry, I just saw you first question/answer now.
The main reason you need to do that is because of categories or other dynamic elements in static libraries. Objective C has Categories which are approximately the same as extensions in Swift, so you can extend classes/objects with additional methods.
In Objective C you can create a static library to link into you project. Without this flag however (-ObjC general of -force_load for a specific library) the symbols of Categories are not loaded outside of the library. I guess an original motivation was to use categories for internal stuff, so the default is not to load them. That also makes the binary a bit smaller. However many libraries actually add Categories (==Extension) they want to expose, so usually you need on of the flags.
Hope that helped a bit ^_^.
Upvotes: 2
Reputation: 130
I finally find out what was causing the issue. I need to add -ObjC flag in "Other Linker Flags" in the Build Settings of the second project.
I don't understand why without this flag the framework has only 72 methods, and with the flags all the methods are available. Someone has an idea?
Upvotes: 0