Library not loaded issue in Xcode

2019-03-31 05:20发布

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

1条回答
放荡不羁爱自由
2楼-- · 2019-03-31 06:02

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.

查看更多
登录 后发表回答