本文介绍了来源:将CocoaPods用于Firebase时出现未绑定变量错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用CocoaPods将FirebaseGoogleTagManager集成到我的iOS应用目标中。当我构建我的目标时,Xcode总是给我错误:


Showing Recent Messages
PhaseScriptExecution [CP] Embed Pods Frameworks 

mkdir -p /Users/xxx.xxx/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/MyApp.app/Frameworks


/Users/xxx.xxx/Projects/MyApp/Applications/MyApp/Pods/Target Support Files/Pods-MyApp/Pods-MyApp-frameworks.sh: line 43: source: unbound variable


Command /bin/sh failed with exit code 1

我已多次清理我的项目,删除了派生数据文件夹,但似乎都不起作用。

我的Podfile如下所示:

platform :ios, '11.0'

target 'MyApp' do

  use_frameworks!

  # Pods for MyApp
    pod 'Firebase/Core', '~> 5.19'
    pod 'Firebase/ABTesting'
    pod 'Firebase/Performance'
    pod 'Firebase/RemoteConfig'
    pod 'Firebase/Analytics'
    pod 'GoogleTagManager', '~> 7.1'
 end

CocoaPods环境

CocoaPods : 1.5.3
        Ruby : ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
    RubyGems : 2.6.8
        Host : Mac OS X 10.14 (18A391)
       Xcode : 10.1 (10B61)
         Git : git version 2.17.2 (Apple Git-113)
Ruby lib dir : /Users/xxx.xxx/.rbenv/versions/2.4.0/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 7c9a708dce25221eabc35ed39

我的项目设置中缺少了什么导致此错误的原因?

我花了几天时间在SO/CocoaPods上寻找解决方案,但一无所获。

在这方面的任何帮助都将不胜感激。

谢谢

推荐答案

当我的框架是用M1芯片构建时,我也遇到了同样的问题。我能够通过从Podfile安装程序部分中删除only_active_Arch来解决这个问题。

所以我替换了这个:

post_install do |installer|

installer.pods_project.targets.each do |target|

target.build_configurations.each do |config|
  config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
  config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'

 end
end

使用此选项:

post_install do |installer|

installer.pods_project.targets.each do |target|

target.build_configurations.each do |config|
  config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
 end
end
注意:我从一开始就添加了[‘Only_Active_Arch’]=‘no’,以便当框架使用非M1芯片构建时,在模拟器中使用问题框架运行我的应用程序。因此,我仍然需要这一行,具体取决于构建机器的芯片。

这篇关于来源:将CocoaPods用于Firebase时出现未绑定变量错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 23:41