菜鸟教程小白 发表于 2022-12-13 15:53:51

ios - 如何为某个 pod 指定特定来源?


                                            <p><p>虽然我相信这是无害的,但警告让我很恼火。因此,我将 <strong>TwilioChatClient</strong> 与 <strong>TwilioClient</strong> 一起使用了一个非常具体的版本。这两个特定版本是 Twilio 在他们的示例项目中使用的版本。</p>

<p>无论如何,安装/更新 pod 时的警告:</p>

<blockquote>
<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.9)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.9/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.9/TwilioChatClient.podspec</p>

<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.8)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.8/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.8/TwilioChatClient.podspec</p>

<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.7)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.7/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.7/TwilioChatClient.podspec</p>

<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.6)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.6/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.6/TwilioChatClient.podspec</p>

<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.5)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.5/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.5/TwilioChatClient.podspec</p>

<p>[!] Found multiple specifications for <code>TwilioChatClient (1.0.4)</code>:
- /Users/XXX/.cocoapods/repos/master/Specs/7/d/e/TwilioChatClient/1.0.4/TwilioChatClient.podspec.json
- /Users/XXX/.cocoapods/repos/twilio/TwilioChatClient/1.0.4/TwilioChatClient.podspec</p>
</blockquote>

<p>我的播客文件:</p>

<pre><code>project &#39;Proj/Proj.xcodeproj&#39;

source &#39;https://github.com/CocoaPods/Specs&#39;
source &#39;https://github.com/twilio/cocoapod-specs&#39;

platform :ios, &#39;10.0&#39;
use_frameworks!

target &#39;Proj&#39; do

    pod &#39;TwilioClient&#39;, &#39;~&gt;1.2&#39;   # Twilio Call Framework
    pod &#39;TwilioChatClient&#39;, &#39;1.0.4&#39; # Twilio Chat Framework


    target &#39;MobileMedTests&#39; do
      inherit! :search_paths
    end

    post_install do |installer|
      installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings[&#39;SWIFT_VERSION&#39;] = &#39;4.0&#39;
            end
      end
    end

end

target &#39;ProjUITests&#39; do

end
</code></pre>

<p>我认为指定两种来源(两者都是必要的)会导致这些警告。有没有办法将特定来源放在 pod 旁边? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>实际上,您的问题来自您已使用以下行将 twilio 存储库添加到您的 pod 源:</p>

<pre><code>source &#39;https://github.com/twilio/cocoapod-specs&#39;
</code></pre>

<p>所以当你输入 <code>pod repo</code> 时,你会得到类似的东西:</p>

<pre><code>master
- Type: git (master)
- URL:https://github.com/CocoaPods/Specs.git
- Path: /Users/cyrille/.cocoapods/repos/master

twilio
- Type: git (master)
- URL:https://github.com/twilio/cocoapod-specs
- Path: /Users/cyrille/.cocoapods/repos/twilio
</code></pre>

<p>当你执行 <code>pod install</code> 时,cocoa pods 可以在 master 的 cocoapods repo 和 twilio 的 repo 中找到这个 lib 的一个版本......这会发出警告。</p>

<p>要删除此警告,请从您的 Podfile 中删除此行:</p>

<pre><code>source &#39;https://github.com/twilio/cocoapod-specs&#39;
</code></pre>

<p>在终端中执行以下命令:</p>

<pre><code>pod repo remove twilio
</code></pre>

<p>然后:</p>

<pre><code>pod update
</code></pre>

<p>您应该不会再收到以下警告:</p>

<pre><code>Analyzing dependencies
Removing TwilioClient
Downloading dependencies
Installing TwilioChatClient 2.2.0 (was 1.0.4)
Installing TwilioSDK (1.2.9)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何为某个 pod 指定特定来源?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/48109435/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/48109435/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何为某个 pod 指定特定来源?