How to create framework with inner frameworks? - ios

I absolutely can not understand how it works. I started with a simple one: created framework using "Cocoa Touch Framework" template and add some code to source files. Then using cocoapods I installed some pods to this framework-project. All looks good (maybe not so good actually) and build fine. After that there was an attempt to connect my framework to other xcode project. I did this as follows: just took my test.framework file from Product folder and transferred to another project. At first everything was not bad. The import was successful and I can use my framework-code in another project. But when I run it I have error: dyld: Library not loaded: Reason: image not found. I tried all of the answers to this problem, but nothing helped me.
After that, it was decided to try to connect my framework to other project. This time I got a completely different behavior: namely, I was able to connect the framework, but I could not access the code inside it. I'm completely confused, because I did not change anything. I just did the same with another project.
Please help me. What am I doing wrong?
A related questions:
Can I connect the framework just moving test.framework file into
another project?
For some reason, I should use the approach described above, is there a chance in the theory of success or all that I have done before is not correct?

I tried it a lot with the same result you get , until I posted the problem in Apple forums and they respond with Nested frameworks are not supported in IOS

Related

Confusion about swift framework build processes

Im currently working on a Swift Framework using OpenCV (3.4.3), and im having some troubles or getting confused about how the build processes work.
Note I'm not using CocoaPods, Im using the framework file/folder provided by OpenCV
So my problem is that I'm creating the swift framework that depends on OpenCV, once I've built my framework and add/link it to a App (Its added to the embedded frameworks section), the app runs fine with no errors. This is where my confusion lies, I would expect to also add OpenCV to my app then have them link at runtime/compile time, but that's not the case OpenCV is magically linked and working. I have also double, triple checked that there is no references of OpenCV in the app to ensure its not getting pulled in anywhere.
For some sanity checks I created a basic framework called TestFramework, which had 1 class, with a static function just so I can test the above process. I added TestFramework to the main framework im working on, and built it. I then added that Framework to my app, and it would not build because the TestFramework was not present in the App as a dependency. Then adding the framework allowed it to build, and the main framework then was able to call the code within the TestFramework.
There seems to be some discrepancy between how the two work, unless the OpenCV framework is built in a different way allowing it to work without the app depending on it.
Any help or thoughts would be great, thanks.

How to create framework with other frameworks and library dependency?

I know, there are so many same questions but I didn't get answer for my requirement.
First time I am creating framework. I have created test framework using Raywenderlich example. But my requirement is little bit different. I used so many different frameworks and also used SQLCipher in my project. Now, I want to convert this project into framework. I followed all the steps but the problem is occur when I am trying to build. Getting an error for SQLCypher because I didn’t add to my framework to avoid conflicts. Finally, I have added SQLCypher library to create build without error and it worked but now I am getting linker error when I am using that framework to test in testProject. I didn’t find any example with third parties. Please help me to solve this issue.
I had the same issue.
One solution is to change all method names of other frameworks or libs, but some lib is not open source.
Another solution is work for me which is to use cocoapods. But the user
who wants to use your framework will be forced using cocoapods, depending iOS 8.0 or above, depending the same version of 3rd libs. I have nothing to do with this restriction.
Seems the best way is do not depend 3rd libs in a framework.

Class GAD_GTMStringEncoding is implemented in both <framework> and <app>. One of the two will be used. Which one is undefined

I have an iOS project in Xcode. It contains a load of linked libraries including GoogleInteractiveMediaAds.framework as well as an internal player library that I believe is also linked against this framework. Both are also embedded binaries.
The project compiles just fine but at runtime I get the following error:
Class GAD_GTMStringEncoding is implemented in both
/GoogleInteractiveMediaAds.framework/GoogleInteractiveMediaAds
and APP_PATH. One of the two will be used. Which one is undefined.
On simulator the app works as expected every time despite this warning - I get the pre-roll, mid-roll and post-roll ads that I'm expecting. Every time. On device it's a different story with the ads sometimes working and sometimes not. I'm aware that the above issue results in different behaviour on different targets and I suspect this conflict is to blame for the broken functionality on devices.
Solutions I've found here on SO suggest either changing the namespaces or removing the linkage from either my app or the library that I'm linking against. The problem is, if I remove the embedded binary in my project then it fails to compile:
dyld: Library not loaded:
#rpath/GoogleInteractiveMediaAds.framework/GoogleInteractiveMediaAds
Referenced from: APP_PATH
Reason: image not found
(lldb)
I've seen a few people suggest what would be removing the linkage from the app and using the player's internal instance (where I then have to hope that the player is compiled against the version that I need), but how on earth do you do that? And would that even work in this case?
Also, is there a way to find out for sure where this other instance of GoogleInteractiveMediaAds.framework is coming from? I'm only assuming that it's inside the internal player library but I don't know for sure as I don't have the source. The error message just provides me with the path to the compiled app which is of little help since there's like 30 linked libraries inside it.
Thanks in advance.
After initially insisting that the issue was somewhere in our code, the Google team responsible for this framework were eventually forced to admit (after we provided a sample app) that it was a problem with their code and not ours. It was resolved in an update.

Why am I getting an unavailable declaration using framework

I'm making a swift .framework, but I'm running into what I believe is a build problem. So I've simplified everything to isolate my troubles. I've attached a screenshot of my newframework.framework project (top) and my example usage of the framework (bottom). The problem I'm having is that Whatever class is unavailable when I include newframework.framework. I can confirm that Whatever.swift is indeed included in target>>buildphases>>compile Sources
What could cause this not to work?
EDIT - Adding App Build phases screenshot
Your problem, as we figured out in comments, was that you were building your framework for "Generic iOS Device" and building your app for the simulator. Xcode can't make the app build without matching architectures, so you need to choose one over the other or produce a framework that includes every architecture.
(This was posted to help people who come here from the future find the answer quickly. Hello, future people!)

xcode build settings for imported libraries (xcode 5)

I'm having a small issue with xcode (I'm assuming it's mostly due to being unfamiliar with xcode itself) and was hoping someone could lend me a hand.
I'm working with a group of people and we're using the GPUimage framework.
The problem is this:
For every person referencing GPUimage we get additional entries in the build settings for the xcode project.
For example build products path would be:
/Users/username/project/application_name/GPUImage-master/GPUimage.framework
I would rather it be:
/application_name/GPUImage-master/GPUimage.framework
The reason I want to fix this is because we need to package up our application and library together so that whoever wants to use it only needs to open the xcode project file to see what we've done (to mark it, school project).
Can anyone suggest what I should do or look for here?
Try adding the following to the beginning of the user path:
$(SRCROOT)/application_name/GPUImage-master/GPUimage.framework
That should instruct XCode to use the user path of whoever is using the library
Hope this helps!

Resources