ld:找不到 -lGoogleToolboxForMac 的库

ld: library not found for -lGoogleToolboxForMac

我正在通过 pods 实施 firebase 设置。

我的 Pods 文件如下所示。

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'
# $(PROJECT_DIR)/build/Debug-iphoneos/GoogleToolboxForMac lib search path
target 'ProductName' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for mCura

pod 'Firebase/Core'
pod 'Firebase/Messaging'

end

iPad 模拟器一切正常。它 运行ning 但是当我 运行 我在 iDevice 中的应用程序时。它显示找不到库。

ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经浪费了 2 天的时间来消除这个错误并尝试了我在网上能找到的一切。 GoogleToolboxForMac 库会在安装 firebase pod 时自动安装。

我将 pod 文件更改为以下代码并重新安装 pod。它为 GoogleToolboxForMac 安装了所有必需的文件。

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'ProductName' do

  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac', '~> 2.1'

end

安装 pod 后

1) 将方案更改为通用 iOS 设备和构建。

2) 构建成功后,您可以看到 libGoogleToolboxForMac.a 文件为黑色而不是红色。

3) 现在 select 设备和 运行 基于 iDevice 构建。按照屏幕截图。

或者您可以构建库 libGoogleToolboxForMac.a

我也遇到了这个异常:

它在打开 Xcode 中的 /platform/ios 文件夹而不是 /platform/ios/MyApp.xcodeproj 文件后得到修复。

感叹.

对于我的 Cordova 项目,我刚刚删除了插件、平台和 node_modules,重新添加了 IOS,然后双击而不是使用 alt-down 打开 xsworkspace,突然它神奇地工作了。

在这里发布这个是为了让我记住可能没有必要寻找真正的解决方案。

这个 Whosebug 问题: 为我提供了解决此问题的答案,但它并不是获得最高赞成票的答案。我必须转到 GoogleToolboxForMac 目标的构建设置并将 "Build Active Architecture Only" 设置从是更改为否。然后清理并重建。

我遇到了同样的错误,只需从 .xcworkspace 文件而不是 .xcodeproj 打开项目即可解决此问题。