Im current working on creating a iOS Swift Framework that uses OpenCV. For good practice we don't want to compile OpenCV into our end framework as this can cause collisions and issues for the framework user.
We figured out that the opencv2.framework we were downloading/using was a static library, so we worked out how to create a dynamic version of the OpenCV Framework from source (https://github.com/opencv/opencv/tree/3.4)
The sources we used to build OpenCV as a Dynamic framework.
https://docs.opencv.org/3.4.3/d5/da3/tutorial_ios_install.html https://github.com/opencv/opencv/pull/8009
In short we ran the following python script to build the dynamic framework
python platforms/ios/build_framework.py ios --dynamic
We successfully built OpenCV as a Dynamic framework, we took the opencv2.framework from opencv/iOS/opencv2.framework as this is the universal framework for the simulator and the device. Then added it to our framework. Then we built our framework which again built successfully.
Then we added our framework to the embedded test application, and pressed run and we get the following error:
dyld: Library not loaded:
/Desktop/Workspace/OpenCV/ios/build/build-iphoneos/lib/Release/opencv2.framework/opencv2
Referenced from:
/private/var/containers/Bundle/Application/UUID/Test.app/Frameworks/SomeFramework.framework/SomeFramework
Reason: image not found
If we also add the opencv2.framework to the app, it gives the following error, this is similar to the error above just a different reference:
dyld: Library not loaded:
/Desktop/Workspace/OpenCV/ios/build/build-iphoneos/lib/Debug/opencv2.framework/opencv2
Referenced from:
/var/containers/Bundle/Application/UUID/TestApp.app/TestApp
Reason: image not found
This is where my error lies, why is the build process trying to find a framework within the OpenCV build directory? When the opencv2.framework is added/embedded within the App?