菜鸟教程小白 发表于 2022-12-11 19:02:57

ios - 无法构建 Objective-C 模块 'CoreGraphics'


                                            <p><p>我在尝试运行任何单元或 UI 测试时遇到以下错误。运行应用程序本身时不会发生。错误信息如下所示:</p>

<pre><code>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: note: while building module &#39;CoreFoundation&#39; imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:
#include &lt;CoreFoundation/CFBase.h&gt;
   ^
&lt;module-includes&gt;:1:9: note: in file included from &lt;module-includes&gt;:1:
#import &#34;Headers/CoreFoundation.h&#34;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
#include &lt;CoreFoundation/CFBase.h&gt;
   ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
#include &lt;Block.h&gt;
   ^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/table/Block.h:10:
#include &#34;leveldb/iterator.h&#34;
   ^
/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:10: note: in file included from /Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/iterator.h:18:
#include &#34;leveldb/slice.h&#34;

/Users/eirik/Documents/Utvikling/iOS/ProsjekterSamarbeid/AnchorPoint Fishing as/FerskFiskiOS/Pods/leveldb-library/include/leveldb/slice.h:21:10: error: &#39;string&#39; file not found
#include &lt;string&gt;
   ^
&lt;module-includes&gt;:1:9: note: in file included from &lt;module-includes&gt;:1:
#import &#34;Headers/CoreGraphics.h&#34;
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:8:
#include &lt;CoreGraphics/CGBase.h&gt;
   ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: error: could not build module &#39;CoreFoundation&#39;
#include &lt;CoreFoundation/CFBase.h&gt;
   ^
&lt;unknown&gt;:0: error: could not build Objective-C module &#39;CoreGraphics&#39;
</code></pre>

<p>我在 Swift 3.2 模式和 CocoaPods 中使用 Xcode 9。我正在使用 Firebase 和 FirebaseUI,它具有 <code>leveldb</code> 作为依赖项。可以看到错误首先在<code>leveldb/slice.h</code>中触发,找不到<code>string</code>文件。</p>

<p>到目前为止,我已经尝试了以下方法:</p>

<ul>
<li>清理(Shift + CMD + K)</li>
<li>移除 DerivedData</li>
<li>清理构建文件夹...</li>
<li>在build设置的框架模块中允许非模块化包含。</li>
<li><code>pod deintegrate</code>, <code>pod clean</code> <code>pod install</code>.</li>
</ul>

<p>对于它的值(value),这是问题导航器中的错误:
<a href="/image/P0mnR.png" rel="noreferrer noopener nofollow"><img src="/image/P0mnR.png" alt="Error in Issue Navigator"/></a> </p>

<p>有什么建议吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>这看起来类似于 <a href="https://github.com/CocoaPods/CocoaPods/pull/7006" rel="noreferrer noopener nofollow">CocoaPods issue</a>这已在 CocoaPods 1.4.0 中修复。没有为单元测试目标正确设置搜索路径。</p>

<p>尝试更新到 CocoaPods 1.4.0 beta 并重新运行 <code>pod update</code> </p>

<p><strong><em>或</em></strong>使用与所描述的<a href="https://github.com/firebase/firebase-ios-sdk/issues/58" rel="noreferrer noopener nofollow">here</a> 类似的解决方法对于 leveldb 路径:</p>

<p>仅在 <code>Build Settings -> Header Search Paths</code></p> 下将 <code>"${PODS_ROOT}/leveldb-library/include"</code> 添加到您的测试目标</p>
                                   
                                                <p style="font-size: 20px;">关于ios - 无法构建 Objective-C 模块&#39;CoreGraphics&#39;,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/46871673/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/46871673/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 无法构建 Objective-C 模块 &#39;CoreGraphics&#39;