xcode ld:找不到 -lFirebaseCore clang 的库:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51797494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:44:04  来源:igfitidea点击:

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

iosxcodefirebasereact-nativereact-native-fcm

提问by amir hossein

I using react-native-fcmfor remote push notification but it gives this error:

react-native-fcm用于远程推送通知,但它给出了这个错误:

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

ld:找不到 -lFirebaseCore clang 的库:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

Pod:

荚:

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

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

  # Pods for SefrTaSad

  pod 'Firebase'
  pod 'Firebase/Messaging'

end

Podfile.lock:

Podfile.lock:

PODS:
  - Firebase (5.5.0):
    - Firebase/Core (= 5.5.0)
  - Firebase/Core (5.5.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 5.1.0)
  - Firebase/CoreOnly (5.5.0):
    - FirebaseCore (= 5.1.0)
  - Firebase/Messaging (5.5.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (= 3.1.0)
  - FirebaseAnalytics (5.1.0):
    - FirebaseCore (~> 5.1)
    - FirebaseInstanceID (~> 3.2)
    - GoogleAppMeasurement (~> 5.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 5.2.0)
    - GoogleUtilities/MethodSwizzler (~> 5.2.0)
    - GoogleUtilities/Network (~> 5.2)
    - "GoogleUtilities/NSData+zlib (~> 5.2)"
    - nanopb (~> 0.3)
  - FirebaseCore (5.1.0):
    - GoogleUtilities/Logger (~> 5.2)
  - FirebaseInstanceID (3.2.0):
    - FirebaseCore (~> 5.1)
    - GoogleUtilities/Environment (~> 5.2)
  - FirebaseMessaging (3.1.0):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - GoogleUtilities/Reachability (~> 5.2)
    - Protobuf (~> 3.1)
  - GoogleAppMeasurement (5.1.0):
    - GoogleUtilities/AppDelegateSwizzler (~> 5.2.0)
    - GoogleUtilities/MethodSwizzler (~> 5.2.0)
    - GoogleUtilities/Network (~> 5.2)
    - "GoogleUtilities/NSData+zlib (~> 5.2)"
    - nanopb (~> 0.3)
  - GoogleUtilities/AppDelegateSwizzler (5.2.2):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (5.2.2)
  - GoogleUtilities/Logger (5.2.2):
    - GoogleUtilities/Environment
  - GoogleUtilities/MethodSwizzler (5.2.2):
    - GoogleUtilities/Logger
  - GoogleUtilities/Network (5.2.2):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (5.2.2)"
  - GoogleUtilities/Reachability (5.2.2):
    - GoogleUtilities/Logger
  - nanopb (0.3.8):
    - nanopb/decode (= 0.3.8)
    - nanopb/encode (= 0.3.8)
  - nanopb/decode (0.3.8)
  - nanopb/encode (0.3.8)
  - Protobuf (3.6.1)

DEPENDENCIES:
  - Firebase
  - Firebase/Messaging

SPEC REPOS:
  https://github.com/cocoapods/specs.git:
    - Firebase
    - FirebaseAnalytics
    - FirebaseCore
    - FirebaseInstanceID
    - FirebaseMessaging
    - GoogleAppMeasurement
    - GoogleUtilities
    - nanopb
    - Protobuf

SPEC CHECKSUMS:
  Firebase: 8c957f9cb3852b519180fb378801b7eeeba4d288
  FirebaseAnalytics: d4a260c114aec0d765ab5b9c404ac63de1d29381
  FirebaseCore: ee4b35cf8c8e781da296cc7c15125e4608bb954d
  FirebaseInstanceID: 8cd2c6cfe7b9ab65ce7e248f6da7f26f6775b9be
  FirebaseMessaging: f67b3719f520ee200da0e20ce577fe2bce0c01d0
  GoogleAppMeasurement: e785bdb86d3d280abc778156cec323a975f11d1d
  GoogleUtilities: 06b66f9567769a7958db20a92f0128b2843e49d5
  nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
  Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5

PODFILE CHECKSUM: 5128fcc348aba846d880d9bb9978b4bf02c0718d

COCOAPODS: 1.5.3

project build whit react-native and I make appId, key and profile the app successfully conected to firebase console but when I want to archive it whit xcode it gives this error:

项目构建 whit react-native 并且我使 appId、key 和 profile 应用程序成功连接到 firebase 控制台,但是当我想用 xcode 将它归档时,它给出了这个错误:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

how can I solve this error ?

我该如何解决这个错误?

采纳答案by thodwris

I resolved opening "PROJECT-NAME".xcworkspace

我解决了打开“PROJECT-NAME”.xcworkspace

回答by Ali SabziNezhad

Add libRNFirebase.ato your Linked Framework and Libraries

添加libRNFirebase.a到您的Linked Framework and Libraries

回答by Osama Hajjar

use in Podfile

在 Podfile 中使用

pod 'Firebase/Core'

after this go to terminal pod update

在此之后转到终端 pod 更新

回答by Juneho Nam

In My case,

就我而言,

when command pod install,

命令时pod install

pod install yellow warnings are showed

显示 pod install 黄色警告

  • Use the $(inherited) flag, or

  • Remove the build settings from the targets.

  • 使用 $(inherited) 标志,或

  • 从目标中删除构建设置。



So when xcode, project

所以当xcode,项目

Project => Build Settings => Library Search Paths

项目 => 构建设置 => 库搜索路径

add $(inherited)by non-recursive.

$(inherited)通过非递归添加 。

then problem solved.

然后问题解决了。

回答by kakbeya

Make sure that all of your ios target versions are the same as in pod file.

确保所有 ios 目标版本与 pod 文件中的相同。