来源:使用 Cocoapods for Firebase 时出现未绑定变量错误

2024-01-11

我已经集成了Firebase and GoogleTagManager使用 Cocoapods 进入我的 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 上寻找解决方案,但徒劳无功。

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

Thanks


当我的框架是用 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 芯片构建时,使用“有问题的”框架在模拟器中运行我的应用程序。 所以我仍然需要这条线,具体取决于构建机器的芯片。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

来源:使用 Cocoapods for Firebase 时出现未绑定变量错误 的相关文章

随机推荐