将框架嵌入iOS框架中 [英] Embed frameworks inside a framework iOS

查看:100
本文介绍了将框架嵌入iOS框架中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含另一个目标(框架)的项目,该目标是主项目的依赖项.该框架需要它自己的框架,因此我使用迦太基添加了它们.该项目可以在模拟器上编译并正常运行,但是在物理设备上运行该项目时出现以下错误:

I have a project containing another target(framework) which is a dependency of the main project. That framework requires it's own frameworks, so I've added them using carthage. The project compiles and runs fine on simulator, however I'm getting the following error when running it on a physical device:

dyld: Library not loaded: @rpath/Subframework.framework/Subframework
  Referenced from: /private/var/mobile/Containers/Bundle/Application/LONG-ID/MyApp.app/Frameworks/MyAppSDK.framework/MyAppSDK
  Reason: no suitable image found.  Did find:
    /private/var/mobile/Containers/Bundle/Application/LONG-ID/MyApp.app/Frameworks/MyAppSDK.framework/Frameworks/Subframework.framework/Subframework: mmap() error 1 at address=0x00798000, size=0x00060000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/LONG-ID/MyApp.app/Frameworks/MyAppSDK.framework/Frameworks/Subframework.framework/Subframework

我尝试了,但是,唯一的解决方案是将子框架添加到顶级项目的嵌入式框架"中,这是不可行的.我曾尝试修改构建设置"->链接"->动态库安装"名称,但这无济于事.

I have tried this, however the only solution is to add the Subframework to "Embed frameworks" to top level project, which is not viable. I've tried modifying Build Settings -> Linking -> Dynamic Library Install name, however it didn't help.

如何实现使其在iPhone上正常工作?

How can achieve make it work on the iphone?

推荐答案

一段时间以来,我也面临这个问题,并且我拥有一个三级层次结构,其中最外面的伞框架"不应与其他框架一起分发.我的解决方法是,在每个伞框架"的构建设置"中的链接"下设置运行搜索路径",以指向在构建阶段"中设置的复制文件"目标(您可以必须添加复制文件"构建阶段,最好将其目标"设置为框架",然后添加要嵌入的每个子框架".

I was also facing this issue for some time and I had a three level hierarchy where the outer most 'Umbrella Framework' should not be distributed with the other frameworks. How I resolved it was by setting the 'Run Search Paths' under 'Linking' in 'Build Settings' of each of the 'Umbrella Framework' to point to the 'Copy Files' destination that is set in the 'Build Phases' (You have to add a 'Copy Files' build phase and preferable set its' destination to 'Frameworks', then add each 'Sub-framework' you want to embed).

将子框架复制到框架"

将运行路径搜索路径"设置为框架"

这篇关于将框架嵌入iOS框架中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆