dyld:未为框架内的框架加载库 [英] dyld: Library not loaded for a Framework within a Framework

查看:116
本文介绍了dyld:未为框架内的框架加载库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试嵌入一个使用另一个框架的框架,这在模拟器中工作正常,但它在iOS设备上崩溃:

I am trying to embed a Framework that are using another Framework and this works just fine in the simulator, but it crashes on an iOS device:


dyld:未加载库:@ rpath / FrameworkB.framework / FrameworkB
引自:/ private / var / mobile / Containers / Bundle / Application / B072CD7C-8595-4AE4-A506-26832A0F4402 / FrameworkTest。 app / Frameworks / FrameworkA.framework / FrameworkA
原因:找不到图像

dyld: Library not loaded: @rpath/FrameworkB.framework/FrameworkB Referenced from: /private/var/mobile/Containers/Bundle/Application/B072CD7C-8595-4AE4-A506-26832A0F4402/FrameworkTest.app/Frameworks/FrameworkA.framework/FrameworkA Reason: image not found

这是我在Xcode中的结构:

This is my structure in Xcode:


  • FrameworkTest.xcodeproj(应用项目)

    • FrameworkA.xcodeproj(Cocoa Touch Framework)

      • FrameworkB.xcodeproj(Cocoa Touch Framework)

      应用程序(FrameworkTest)使用FrameworkA中的类 A (嵌入在FrameworkTest中)应用程序)。类 A 使用FrameworkB中的类 B (在FrameworkA中链接)。

      The app (FrameworkTest) uses a class A from FrameworkA (which is embedded in the FrameworkTest app). The class A uses the class B from FrameworkB (which is linked in FrameworkA).

      这在模拟器中工作正常,但它在设备上不起作用。

      This works just fine in the simulator, but it does not work on the device.

      结构可能看起来有点奇怪,但我我在开发应用程序时正在开发框架,这就是我想在我的应用程序项目中添加框架项目的原因。

      The structure may seem a bit strange, but I am developing the frameworks as I go when I develop the app, which is why I want to add the framework projects inside my app project.

      我已经上传了项目在GitHub 上供您查看,如果您需要仔细查看。 (在AppDelegate.m文件中调用类 A

      I have uploaded the project on GitHub for you to see, if you need to take a closer look. (The class A is invoked in the AppDelegate.m file)

      为什么这在iOS模拟器和不在设备上?我怎样才能让它在设备上运行?

      Why is this working in the iOS simulator and not on the device? And how can I make it work on the device?

      编辑:

      正如simonthumper在评论中建议的那样,我还尝试将 FrameworkB.framework 添加到复制文件作为Build中的Frameworks目标FrameworkA的阶段,但在控制台中给出了这个错误:

      As simonthumper suggests in the comments, I have also tried to add FrameworkB.framework to Copy Files as Frameworks destination in Build Phases for FrameworkA, but that gives me this error in the console:


      dyld:未加载库:@rpath / FrameworkB.framework / FrameworkB
      参考自:/private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/FrameworkA
      原因:没有合适的图片找到。找到:
      /private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/Frameworks/FrameworkB.framework/FrameworkB:mmap( )地址= 0x10012C000时的错误1,大小= 0x00008000段= __ Sext :: map()中的文本映射/private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks /FrameworkA.framework/Frameworks/FrameworkB.framework/FrameworkB

      dyld: Library not loaded: @rpath/FrameworkB.framework/FrameworkB Referenced from: /private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/FrameworkA Reason: no suitable image found. Did find: /private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/Frameworks/FrameworkB.framework/FrameworkB: mmap() error 1 at address=0x10012C000, size=0x00008000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/Frameworks/FrameworkB.framework/FrameworkB


      推荐答案

      我联系了Apple问题并找到了我的问题的解决方案。 Apple的技术支持明确表示,我需要将FrameworkB.xcodeproj添加到我的应用程序项目中,因此我的项目结构是:

      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 my project structure is:


      • FrameworkTest .xcodeproj(应用项目)


        • FrameworkA.xcodeproj(Cocoa Touch Framework)


          • FrameworkB.xcodeproj(Cocoa Touch Framework)

          当我这样做时,应用程序项目可以包含FrameworkB.framework作为嵌入式库:

          When I have done this the application project can include FrameworkB.framework as an Embedded Library:

          这解决了我的问题并成功了可以在iOS设备上运行。

          This solved my problem and made it possible to run it on an iOS device.

          如果版本在版本崩溃时崩溃:
          撤销企业分发证书并创建新的一个解决问题。一旦我做到了,它就完美无缺。

          If the build crashes on Release: Revoke your Enterprise Distribution certificate and create a new one to solve the problem. Once I did that it worked perfectly.

          这篇关于dyld:未为框架内的框架加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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