• <small id='573fb'></small><noframes id='573fb'>

        <i id='573fb'><tr id='573fb'><dt id='573fb'><q id='573fb'><span id='573fb'><b id='573fb'><form id='573fb'><ins id='573fb'></ins><ul id='573fb'></ul><sub id='573fb'></sub></form><legend id='573fb'></legend><bdo id='573fb'><pre id='573fb'><center id='573fb'></center></pre></bdo></b><th id='573fb'></th></span></q></dt></tr></i><div id='573fb'><tfoot id='573fb'></tfoot><dl id='573fb'><fieldset id='573fb'></fieldset></dl></div>
        <legend id='573fb'><style id='573fb'><dir id='573fb'><q id='573fb'></q></dir></style></legend>
        • <bdo id='573fb'></bdo><ul id='573fb'></ul>

        <tfoot id='573fb'></tfoot>

        如何在 Swift 框架中使用 Cocoapods?

        时间:2023-05-17

        <small id='1tVpK'></small><noframes id='1tVpK'>

        <tfoot id='1tVpK'></tfoot>
          <tbody id='1tVpK'></tbody>

        <i id='1tVpK'><tr id='1tVpK'><dt id='1tVpK'><q id='1tVpK'><span id='1tVpK'><b id='1tVpK'><form id='1tVpK'><ins id='1tVpK'></ins><ul id='1tVpK'></ul><sub id='1tVpK'></sub></form><legend id='1tVpK'></legend><bdo id='1tVpK'><pre id='1tVpK'><center id='1tVpK'></center></pre></bdo></b><th id='1tVpK'></th></span></q></dt></tr></i><div id='1tVpK'><tfoot id='1tVpK'></tfoot><dl id='1tVpK'><fieldset id='1tVpK'></fieldset></dl></div>

            • <legend id='1tVpK'><style id='1tVpK'><dir id='1tVpK'><q id='1tVpK'></q></dir></style></legend>
                • <bdo id='1tVpK'></bdo><ul id='1tVpK'></ul>

                  本文介绍了如何在 Swift 框架中使用 Cocoapods?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试使用 Cocoapods 中的一些库在 Swift 中为 iOS 创建一个新的 Cocoa Touch 框架,但我无法让它工作.我知道有一些未解决的问题,但似乎没有一个能解决我的问题.

                  I am trying to create a new Cocoa Touch Framework for iOS in Swift, using some libraries from Cocoapods, but I can't have it work. I know there are some opened questions about that, but none of them seem to fix my problem.

                  出于测试目的,我刚刚创建了一个空的 Cocoa Touch 框架,安装了 Cocoapods 并添加了MBProgressHUD"pod.然后,正如 Apple 记录的('Importing来自同一框架目标部分的代码),我在我的伞头文件中导入了 MBProgressHUD 头文件,如下所示:

                  For testing purposes, I just created an empty Cocoa Touch Framework, installed Cocoapods and added the 'MBProgressHUD' pod. Then, as documented by Apple ('Importing Code from Within the Same Framework Target' section), I imported the MBProgressHUD header in my umbrella header like that:

                  #import "MBProgressHUD.h"
                  

                  但是当我编译时,我有这个错误:

                  But when I compile, I have this error:

                  include of non-modular header inside framework module
                  

                  我确实将允许框架模块中的非模块化包含"设置为是",但它没有任何效果.

                  I did set the 'Allow Non-modular includes in Framework Modules' setting to Yes, but it doesn't have any effect.

                  有没有办法在 Swift 框架中使用 CocoaPods?

                  Is there any way to use CocoaPods in a Swift Framework?

                  推荐答案

                  我找到了解决方案,所以我会放在这里,以防其他人有同样的问题.

                  I found the solution, so I will let it here in case someone else has the same issue.

                  所以,Cocoapods 从 0.36 版开始就支持 iOS 框架,正如 在他们的博客中所说,要在框架中使用它,您只需在 Podfile 中添加这一行:

                  So, Cocoapods supports iOS frameworks since version 0.36, and as it's said in their blog, to use it in a framework, you just have to add this line in your Podfile:

                  use_frameworks!
                  

                  之后,在 Swift 框架中,您不需要在伞头文件中包含 .h 文件,但您需要在任何需要的地方导入模块,例如:

                  After that, in a Swift framework, you don't need to include the .h files in your umbrella header, but you do need to import the module wherever you need it, for instance:

                  import MBProgressHUD
                  

                  这对我有用,希望对您有所帮助!

                  This is working for me, hope it helps!

                  这篇关于如何在 Swift 框架中使用 Cocoapods?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在不创建 Umbrella 框架的情况下构建一个依赖于另一个框架的 iOS 框架 下一篇:iOS:无法构建模块 &lt;framework-name&gt;

                  相关文章

                • <legend id='mxkso'><style id='mxkso'><dir id='mxkso'><q id='mxkso'></q></dir></style></legend>
                  <tfoot id='mxkso'></tfoot>
                  1. <i id='mxkso'><tr id='mxkso'><dt id='mxkso'><q id='mxkso'><span id='mxkso'><b id='mxkso'><form id='mxkso'><ins id='mxkso'></ins><ul id='mxkso'></ul><sub id='mxkso'></sub></form><legend id='mxkso'></legend><bdo id='mxkso'><pre id='mxkso'><center id='mxkso'></center></pre></bdo></b><th id='mxkso'></th></span></q></dt></tr></i><div id='mxkso'><tfoot id='mxkso'></tfoot><dl id='mxkso'><fieldset id='mxkso'></fieldset></dl></div>

                      <small id='mxkso'></small><noframes id='mxkso'>

                      • <bdo id='mxkso'></bdo><ul id='mxkso'></ul>