Use_frameworks!
FRAMEWORK
A framework is a bundle (a structured directory) that contains a dynamic shared library along with associated resources, such as nib files, image files, and header files. When you develop an application, your project links to one or more frameworks.
For example, iPhone application projects link by default to the Foundation, UIKit, and Core Graphics frameworks. Your code accesses the capabilities of a framework through the application programming interface (API), which is published by the framework through its header files. Because the library is dynamically shared, multiple applications can access the framework code and resources simultaneously.
The system loads the code and resources of a framework into memory, as needed, and shares the one copy of a resource among all applications.
DYNAMIC AND STATIC LIBRARIES
First of all, a library is a collection of resources and the code itself, compiled for one or more architectures.
Let’s briefly touch on what dynamic and static libraries are and clarify the main difference. The word static or dynamic refers to the way the compiled code is referenced by the target application.
In the case of static libraries (*.a), the code that the app uses is copied to the generated executable file by a static linker during compilation time.
Dynamic libraries (*.dylib) are different from static libraries in the sense that they are linked with the app’s executable at runtime, but not copied into it. As a result, the executable is smaller and, because the code is loaded only when it is needed, the startup time is typically faster.
Use frameworks in PodFile
If your project has podfile but you didn’t write use_frameworks! at the beginning and all works fine and if you try to use another dynamic framework it may not work that what, I have encountered trying to use ‘SDWebImageWebPCoder’ it installed but did not work.
Targets
If you have more than one target like in the previous image, and in one of them you did not write use_framework! and already trying to install one of these dynamic libraries it’s going to be installed but won’t work, I have encountered this problem before and this is the error image.
Solution
- Go to Xcode
- Select your HOST target.
- Open the target’s ‘Build Phases’ page
- Dependencies
- remove your dependencies and add them again
- go to podfile and add “use_frameworks!” in both targets
IMP Note
If you had installed firebase before putting use_frameworks! It maybe not work and gives you an error “Cannot find ‘FirebaseApp’ in scope” don’t worry just uninstall and install firebase again it will work.
Conclusion
This solution may not work for you, but it works with me after so much digging and searching, I just want to share it if someone encountered the same problem maybe it would help. Thanks!