Xcode10 - dyld: Library not loaded for pod installed in framework

前端 未结 6 2220
后悔当初
后悔当初 2021-02-12 12:26

I have a project with target frameworks.

  • MainAppTarget
  • FrameworkA

FrameworkA is the only one to use a certain pod, hence in my pod file I h

6条回答
  •  醉梦人生
    2021-02-12 12:59

    The reason the build succeeds is that the PodA framework is visible to the FrameworkA during compilation (it can link to it), but when the application launches, then it tries to find and load the dynamic framework PodA required by the FrameworkA, and it looks like the PodA is not embedded in the MainAppTarget, so the app crashes with the error message you saw.

    To fix this, make sure that the PodA framework is embedded in the MainAppTarget. Specifically, you need to make sure that the final app bundle contains the PodA.framework in the Framewokrs subfolder. Usually cocoapods copies the frameworks automatically.

    Check that the Build Phases for the MainAppTarget contains cocoapods's [CP] Embed Pods Frameworks and that the scripts' input files contain the path to the PodA framework. Something like this (example shows Alamofire pod):

    I have set up a project with the details you posted, but it looks to me that cocoapods handles this case automatically in the created workspace setup (you can take a look at my demo project here: https://github.com/DmitryBespalov/StackOverflowPodFramework). If your setup is different, please let me know of the details and I can help you further with that.

提交回复
热议问题