5

I've done some search for answer of Library not loaded and I found almost every answer related to using framework in Application but my problem is different. Its actually using framework in framework and then use in App.

Lets say I have framework A and B, framework A use framework B and then framework Library not loaded use in App so eventually I only want to use or expose frame A in app rather than both and there is no directly need of Framework Library not loaded in App.

What I've done so far:

Added Framework A into App and added also into Embedded Binaries and use some code of Framework A but no Framework B. Build and Run

Issue

Build succeeded but right after installing app into device this generate issue.

dyld: Library not loaded: @rpath/B.framework/B
Referenced from: /private/var/containers/Bundle/Application/6A869182-AFE5-403-2809B4AAA843/A-SDK-DemoApp.app/Frameworks/A.framework/A Reason: image not found

note: Frameworks name changed according to A and B.

Requirement I only want to share framework A with client instead of framework B, because App will communicate with framework A only, so need some suggestion how to resolve this, also please don't refer me those answer that relate to single frame add into app. Thanks

Aleem
  • 3,173
  • 5
  • 33
  • 71
  • It's not clear to me whether you are adding a framework manually copied or using Cocoa Pods. In any case it would seem to me that if framework A needs framework B then it should be included. A lot of times build issues that I've run into were eventually solved by adding the framework that is asking or checking the build settings under Project Navigator > TARGETS > Build Settings > Architectures > Build Active Architecture Only > NO This is specially true if you are using Cocoa Pods. for some reason the default YES causes issues. Set it to NO in all configs i.e. debug, release. Hope it helps. – Adam Mendoza May 18 '18 at 00:47

1 Answers1

2

After spending some time and read this answer, which clearly says

I contacted Apple with this issue and found a solution to my problem. Apple's Technical support made it clear, that I need to add the FrameworkB.xcodeproj to my application project

So I just used some trick, in Framework A go to Target -> Add New Copy File Phase -> Changed destination to Framework -> add Framework B as shown in screen shot.

enter image description here

Now build Framework A, go to Product folder and click on show in finder Framework A, you will see Framework B will be added and expose inside A as show in screenshot.

enter image description here

This all from framework side, Now add framework A in Embedded section inside App. Now again try to add another framework in Embedded section and click Add Others button, click on Framework A -> click on Framework folder choose Framework B as shown in screenshot.

enter image description here

This will resolve issue.If someone not understand feel free to comment I'll try to make it clear. Hope this will help others too.

Aleem
  • 3,173
  • 5
  • 33
  • 71