菜鸟教程小白 发表于 2022-12-11 19:09:59

ios - 处理 Podfile 的 post-install 钩子(Hook)时出错


                                            <p><p><code>post_install</code> 曾经在我运行 <code>pod install</code> 或 <code>pod update</code> 时工作。但是现在它抛出一个错误:</p>

<pre><code>[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `push&#39; for #&lt;String:0x007f8726e2ee60&gt;
Did you mean?puts

/Users/waseefakhtar/Documents/iOS /Swift 3/Canary/Podfile:39:in `block (4 levels) in from_ruby&#39;
/Users/waseefakhtar/Documents/iOS /Swift 3/Canary/Podfile:37:in `each&#39;
/Users/waseefakhtar/Documents/iOS /Swift 3/Canary/Podfile:37:in `block (3 levels) in from_ruby&#39;
/Users/waseefakhtar/Documents/iOS /Swift 3/Canary/Podfile:36:in `each&#39;
/Users/waseefakhtar/Documents/iOS /Swift 3/Canary/Podfile:36:in `block (2 levels) in from_ruby&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.3.1/lib/cocoapods-core/podfile.rb:179:in `post_install!&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:619:in `run_podfile_post_install_hook&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:607:in `block in run_podfile_post_install_hooks&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:606:in `run_podfile_post_install_hooks&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:185:in `block in generate_pods_project&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:182:in `generate_pods_project&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:119:in `install!&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/update.rb:81:in `run&#39;
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run&#39;
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in `&lt;top (required)&gt;&#39;
/usr/local/bin/pod:23:in `load&#39;
/usr/local/bin/pod:23:in `&lt;main&gt;&#39;
</code></pre>

<p>这是我的 Podfile:</p>

<pre><code># Uncomment this line to define a global platform for your project
platform :ios, &#39;10.0&#39;
# Uncomment this line if you&#39;re using Swift
use_frameworks!

target &#39;CanaryApp&#39; do

pod &#39;Firebase&#39;
pod &#39;Firebase/Auth&#39;
pod &#39;Firebase/Core&#39;
pod &#39;Firebase/Database&#39;
pod &#39;Firebase/Storage&#39;
pod &#39;Firebase/Analytics&#39;
pod &#39;Firebase/Messaging&#39;
pod &#39;Firebase/AdMob&#39;
pod &#39;PINRemoteImage&#39;
pod &#39;SwiftyJSON&#39;
pod &#39;SDWebImage&#39;, &#39;~&gt;3.8&#39;
pod &#39;NSDate+TimeAgo&#39;
pod &#39;Alamofire&#39;, &#39;~&gt; 4.4&#39;
pod &#39;SSBouncyButton&#39;, &#39;~&gt; 1.0&#39;
pod &#39;CSNPlaceholderTextView&#39;, &#39;~&gt; 0.0&#39;
pod &#39;SkyFloatingLabelTextField&#39;
pod &#39;Font-Awesome-Swift&#39;, &#39;~&gt; 1.6.2&#39;
pod &#39;RSKGrowingTextView&#39;
pod &#39;RSKPlaceholderTextView&#39;
pod &#39;RSKKeyboardAnimationObserver&#39;
pod &#39;SCLAlertView&#39;
pod &#39;PureLayout&#39;
pod &#39;RSKImageCropper&#39;
pod &#39;SwiftSpinner&#39;

end

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
            if target.name == &#34;SkyFloatingLabelTextField&#34;
                config.build_settings[&#39;LD_RUNPATH_SEARCH_PATHS&#39;].push(&#39;/Applications/Xcode.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator&#39;)
            end
      end
    end

    installer.pods_project.targets.each do |target|
      if target.name == &#39;RSKPlaceholderTextView&#39;
            target.build_configurations.each do |config|
                config.build_settings[&#39;LD_RUNPATH_SEARCH_PATHS&#39;] = [&#39;$(inherited)&#39;, &#39;/Applications/Xcode.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator&#39;]
            end
      end
    end
end

target &#39;CanaryAppTests&#39; do

end

target &#39;CanaryAppUITests&#39; do

end
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p><code>运行 gem install xcodeproj </code></p>
<p><code>pod install</code>再次</p>
<p>希望这对你有用...!</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 处理 Podfile 的 post-install 钩子(Hook)时出错,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/47051477/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/47051477/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 处理 Podfile 的 post-install 钩子(Hook)时出错