<small id='7PbPB'></small><noframes id='7PbPB'>

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

        Swift 应用程序:导入静态库的框架时“缺少必需的模块"

        时间:2023-05-19
          <i id='Tt60U'><tr id='Tt60U'><dt id='Tt60U'><q id='Tt60U'><span id='Tt60U'><b id='Tt60U'><form id='Tt60U'><ins id='Tt60U'></ins><ul id='Tt60U'></ul><sub id='Tt60U'></sub></form><legend id='Tt60U'></legend><bdo id='Tt60U'><pre id='Tt60U'><center id='Tt60U'></center></pre></bdo></b><th id='Tt60U'></th></span></q></dt></tr></i><div id='Tt60U'><tfoot id='Tt60U'></tfoot><dl id='Tt60U'><fieldset id='Tt60U'></fieldset></dl></div>
            <tbody id='Tt60U'></tbody>

            <tfoot id='Tt60U'></tfoot>
              • <bdo id='Tt60U'></bdo><ul id='Tt60U'></ul>
                <legend id='Tt60U'><style id='Tt60U'><dir id='Tt60U'><q id='Tt60U'></q></dir></style></legend>

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

                  本文介绍了Swift 应用程序:导入静态库的框架时“缺少必需的模块"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  这是我的设置:

                  1. Objective C 代码的静态库,称为 Stat.
                  2. 一个 Swift 框架,它在自己的类中使用来自 Stat 的代码(这个框架称为 Dyn).静态库和这个框架在同一个 Xcode 项目中.
                  3. 将上述项目作为子项目并链接到 Dyn 的 Mac 应用程序/项目.
                  1. Static library of Objective C code called Stat.
                  2. A Swift framework that uses code from Stat in its own classes (this framework is called Dyn). The static library and this framework are in the same Xcode project.
                  3. A Mac app / project that has the above project as a subproject and which links to Dyn.

                  在我的应用中,我的代码如下:

                  In my app I have code like:

                  import Cocoa
                  import Dyn
                  ...
                  SomeDynClass().doSomething()
                  

                  但是,当我尝试编译时,当我 import Dyn 时出现错误.错误是

                  However, when I try to compile I get an error when I import Dyn. The error is

                  error: missing required module ‘Stat'
                  

                  我的应用似乎可以很好地找到我的框架,但不知何故它也需要为我的静态库找到一个模块?

                  It appears my app can find my framework just fine, but it somehow needs to find a module for my static library, too?

                  Stat 有一个非常基本的模块文件:

                  Stat has a module file that’s pretty basic:

                  module Stat {
                      header "Stat.h"
                      export *
                  }
                  

                  我认为我需要将我的 Mac 应用程序的框架搜索路径指向 Stat,但我不知道为什么,也不知道如何操作.我该如何解决?

                  I think I need to point my Mac app’s framework search paths at Stat but I don’t know why and I don’t know how. How do I solve this?

                  推荐答案

                  选择你的 Target,然后进入 Build Settings 并设置 Import PathsSwift Compiler - Search Paths 部分中的 code>:

                  Select your Target, then go into Build Settings and set the Import Paths within the Swift Compiler - Search Paths section:

                  ${SRCROOT}/Stat
                  

                  通常,模块的名称与库的名称相同,但是,我不确定您是如何使用 module.map 设置目录的(可以命名为 Dyn 也许,在这种情况下,导入路径将反映该名称.

                  Normally the module would be named the same as the library, however, I'm not sure how you've setup the directory with the module.map (it could be named Dyn perhaps, in which case the Import Path would reflect that name.

                  构建设置 >Swift 编译器 >搜索路径:

                  ${SRCROOT}/(module.map 的目录) 应该自己解析一次你按 enter 或 tab ..

                  ${SRCROOT}/(directory with module.map) should resolve itself once you press enter or tab..

                  这篇关于Swift 应用程序:导入静态库的框架时“缺少必需的模块"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:具有 Pod 依赖项的 XCFramework 下一篇:“弱链接"是什么意思?一个框架?

                  相关文章

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

                    <bdo id='iEOrq'></bdo><ul id='iEOrq'></ul>
                      <tfoot id='iEOrq'></tfoot>