How Objective-C Runtime detect framework is exist - ios

I'm making a framework that use several third party framework, and those third party framework were install by developer who use my framework using cocoapods, I got some problem and I can not find any solution.
I was try __has_include to detect framework is exist, that just work at compiler time not work at runtime.
The problem like below:
How detect framework exist at runtime.
I need import framework if the framework exist.
I need to implement the third party protocol if the framework exist.

Related

Xcode links a Third Party framework in my Framework and includes it's symbols

I am building a Framework and the code there uses a Third party framework. When I compile my Framework it seems to contain all the symbols from the Third party framework. If I don't add the third party framework to Linked Frameworks and Libraries I get compiler errors about undefined symbols.
On the other hand, when I add the third party framework to Linked Frameworks and Libraries it compiles fine. However, in a sample app when I link both my framework and the third party one I get the following runtime warnings: Class is implemented in both, One of the two will be used. Which one is undefined.
My question is how do I build my framework with a dependency on another framework without actually linking it? I want to do all the linking on the app level.
I wasn’t able to achieve this behavior building dynamic frameworks. However, as I built my framework as static, the framework compiled fine and did not include third party framework symbols. All the linking with the third party framework has to be done on the app level.
I have seen many questions on stack overflow like this with no definite answer. I hope my finding would help.

How to create a cocoa touch framework from a code that depends on 3rd party libraries?

I am trying to create a cocoa touch framework out of my existing app so it can be embedded in other apps via a simple drag and drop.
The thing is my app uses a lot of libraries and have been using cocoapods to manage dependencies.
I already know how to build a simple framework but I couldn't find a source that talked about how to turn a complex project with lots of dependency into a framework.
Questions:
Is it even possible to achieve my goal (Package my own code and all the libraries it depends on into a single framework that can be easily embedded into other projects)
if yes what's the right way to do it?
Assuming all of the above were resolved, what happens when the parent app also contains some of the same libraries that are being used in my framework?

How can be 'Class is implemented in both' issue be solved inside of an iOS framework?

I am building an iOS framework which embeds a 3rd party static library. If the developer implementing the framework wants to also include the 3rd party static library which has been used, multiple 'Class is implemented in both' warnings will be displayed at runtime. How can I solve those warnings providing I can't rename the classes since the library is compiled?
Thank you in advance.
If you are distributing manually, you have to tell everything(which 3rd party library to add in Link Binary with Libraries, Other Linker Flags & probably few more) to your client.
Eg: Install Manually section for GoogleMaps
If you have a Podspec(which probably means the 3rd party Library also does), then you can simply add dependency to it like this
BTW static library can't be embedded in an iOS Framework, you can only link it.

Using code from framework without linking it

I am building a cocoa touch framework and including in my code third party framework - "framework_X"
How can i use it in a way that "framework_X" will not be linked directly to my framework, instead it will require the consumer project which use my framework to link "framework_X" to his project in order for it to work.
In Android this is done easily, but in Xcode if i am not linking the "framework_X" in my framework the project won't build
You can load libraries at runtime. Here an example of loading zlib with dlopen():
https://github.com/nicklockwood/GZIP/blob/master/GZIP/GZIP.m

iOS self made framework can contain other third party framework ?

all:
My company now uses sereval third-party framework,now we want to make ourselves sdk ,the sdk hide all the details of the third party framework ,can this be implemented? How I can get some information of this ?
Generally, you have two ways to make SDK with third part framework.
Rename the classes name in third part framework with prefix string. For example, ASIHttp, change to MySDK_ASIHTTP. This can prevent compile error when uses include the same third part framework in their project.
Don't include third part framework, just write a document which tells use to add required third part framework by themselves. This make use just have only a copy of third part framework in their project.
If you have modified the third part frameworks, I think you should use 1 method

Resources