Use a third-party structure embedded in the dynamic structure

As I understand it, a big change in the dynamic structure of ios and statics is due to the fact that the static code is statically linked to the code during the connection (before launch), and the dynamics is connected during startup / execution

Now I have a test project:

My project has a dynamic structure associated with it - A.framework.

import A.framework

A.framework has a framework built inside it - B.framework

In my main project, I want to use classes from B.framework

Now I see this with a simple import operation in the main project:

 import B.framework 

This really works, and I can use the code from inside B.framework, which is embedded in the associated A.framework

How can it be? Is it something safe and reliable to use? How does the main project recognize B.framework?

What about cases where the main project directly links B.framework to the project? in this case, I see a lot of "repeated character errors" during the connection

Most importantly, how can I build A.framework without inserting B.framework inside it, and not using its classes and functions

Any clarifications will help :)

+6
source share
2 answers

As you noticed, binding B.framework will lead to duplication of characters. This is why A.framework should not embed B.framework. You should never embed the framework in another structure if there is a chance that the consumer application will take care of the built-in infrastructure (in practice, this means that you really should just not do this).

A.framework was packed incorrectly. If you pack it, you must remove the built-in infrastructure and link everything at the application level. If someone else has packaged it, you must open a problem with them to fix this error. This problem is not new for dynamic frameworks. This is also a problem with static frames. The only suitable time for dependency binding is at the application level.

(There is an exception if you control the entire ecosystem (for example, Apple). Then things like umbrella frames , but you are not Apple.)

EDIT: It's normal to bind, but not embed, a common structure into another common structure. The key is that a single copy of the overall structure must come from a top-level application. Since this final step of the link will be executed at boot time, then you will not have duplicate characters, because there is only one copy of the general structure. Just do not insert the subframe into yours.

For instance:

  • Create a project using the target environment
  • Drag and drop GMA.framework into the target framework environment (this will cause it to snap, but not embed).
  • Create Application Target
  • The application has a link to both GMA.framework and your test environment. This will work perfectly without collisions, because there is only one GMA.framework, and it is only built into the application.
+7
source

If you use multiple frameworks, you can try the Cocoa Pods dependency manager, which will help you access multiple frameworks. It will also allow you to save a breakpoint that helps you debug even inside the frame, and you can also make changes.

0
source

All Articles