菜鸟教程小白 发表于 2022-12-11 19:29:36

iOS 库找不到标题


                                            <p><p>我正在尝试将 Segment 分析与 React Native 包装器库 (react-native-segment-analytics) 集成。核心 Segment iOS 库已添加为 Pod(使用 <code>use_frameworks!</code>);我已将 SegmentAnalytics.xcodeproj 放入 <code>Libraries/</code> 的包装库。</p>

<p>我遇到的错误是</p>

<blockquote>
<p>.../node_modules/react-native-segment-analytics/ios/SegmentAnalytics/Classes/SegmentAnalytics.m:7:9: fatal error: &#39;Analytics/SEGAnalytics.h&#39; file not found</p>
</blockquote>

<p>有问题的行是</p>

<p><code>#import <Analytics/SEGAnalytics.h></code></p>

<p> <a href="/image/YtIsX.png" rel="noreferrer noopener nofollow"><img src="/image/YtIsX.png" alt="Libraries"/></a> </p>

<p> <a href="/image/0QCa5.png" rel="noreferrer noopener nofollow"><img src="/image/0QCa5.png" alt="SEGAnalytics.h"/></a> </p>

<p>我很确定这不是 Segment 所特有的,但我把它留在这里以防万一。</p>

<p> header 在项目中可用。事实上,我可以在项目根目录的源文件中添加相同的 <code>#import</code> 并且它可以很好地解决。我能辨别的唯一区别是包装库是嵌入式 xcodeproj。</p>

<p>似乎每个 Xcode 配置选项都试图解决这个问题,包括尝试不同的 header 搜索路径和框架搜索路径,尝试将 Segment 库作为链接的二进制文件添加到我能想到的任何地方,甚至将导入从 <> 更改为 ""语法。</p>

<p>感谢任何帮助。</p>

<p><strong>编辑</strong>:使用的库:</p>

<p><strong>Edit2</strong>:添加了一些文本以尝试阐明 Segment 与 react-native-segment-analytics 库的对比。</p>

<p> <a href="https://github.com/segmentio/analytics-ios" rel="noreferrer noopener nofollow">https://github.com/segmentio/analytics-ios</a> </p>

<p> <a href="https://github.com/charlires/react-native-segment-analytics" rel="noreferrer noopener nofollow">https://github.com/charlires/react-native-segment-analytics</a> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>尝试使用安装<a href="https://github.com/smore-inc/react-native-segment-io-analytics" rel="noreferrer noopener nofollow">instructions</a>来自这个库的开发者:</p>
<blockquote>
<p><strong>Installation</strong></p>
<ol>
<li>Download and install the npm package by running npm install --save react-native-segment-io-analytics</li>
<li>In your Podfile, add pod &#34;Analytics&#34; to your project and run pod install in your ios folder</li>
<li>Inside Xcode (make sure you&#39;ve opened your .xcworkspace file), go to the project navigator and right click Libraries -&gt; Add Files to .</li>
<li>Go to node_modules -&gt; react-native-segment-io-analytics -&gt; and choose the RNSegmentIOAnalytics.xcodeproj file.
Make sure your project links to libAnalytics.a and libRNSegmentIOAnalytics.a (The libraries should be listed under &#34;Build Phases -&gt; Link Binary With Libraries&#34;).</li>
</ol>
</blockquote>
<p>您可能错过了一些步骤。</p></p>
                                   
                                                <p style="font-size: 20px;">关于iOS 库找不到标题,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/43399270/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/43399270/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iOS 库找不到标题