CocoaPods找不到Firebase.h文件

时间:2019-05-04 12:18:03

标签: ios xcode firebase react-native cocoapods

我正在尝试将Firebase添加到我的项目中。我只是在Pod下方添加到我的Xcode项目中。

  pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  pod 'Firebase/Database'
  pod 'Firebase/Auth'

在安装podfile之后,我尝试将Firebase导入到我的项目中。但这给我一个错误,找不到 Firebase.h。

na

当我从Run script only when installing中取消选中[CP] Check pods Manifest.lock时,将发生上述问题。之后,我将使用pod install安装pod。然后问题就会发生。

取消选中复选框后出现错误:

error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

2 个答案:

答案 0 :(得分:2)

我在项目中遇到了同样的问题,

我手动编写了项目及其库链接,以解决我按照此链接步骤工作的问题 https://github.com/invertase/react-native-firebase-docs/blob/master/docs/installation/ios.md

此外,您还必须检查Xcode项目上的库与二进制文件的链接。

另一种解决方案是您可以删除所有依赖于lib的pod,然后pod initpod install

之后添加手动pod库

答案 1 :(得分:0)

在命令行“ cordova build ios --release --device ”上执行时,我遇到了相同的错误,并且我确信编译使用的是.xcworkspace文件。当我从xCode构建项目时,工作正常。

科尔多瓦版本:8.0.0和9.0.0 离子:1.0.0 cordova-android :^ 8.1.0 cordova-ios :^ 5.1.1

这是日志...

Checking config.xml for pods.
No new pods detects
Reading build config file: /mobile/build.json
Building project: /mobile/platforms/ios/MyProject.xcworkspace
    Configuration: Release
    Platform: device
    Target: 
Adding xcodebuildArg: -UseModernBuildSystem=0
Running command: xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -configuration Release -destination generic/platform=iOS -archivePath MyProject.xcarchive archive CONFIGURATION_BUILD_DIR=/mobile/platforms/ios/build/device SHARED_PRECOMPS_DIR=/mobile/platforms/ios/build/sharedpch -UseModernBuildSystem=0
User defaults from command line:
    IDEArchivePathOverride = /mobile/platforms/ios/MyProject.xcarchive
    UseModernBuildSystem = 0

Build settings from command line:
    CONFIGURATION_BUILD_DIR = /mobile/platforms/ios/build/device
    SHARED_PRECOMPS_DIR = /mobile/platforms/ios/build/sharedpch

Prepare build
note: Using legacy build system

...

/mobile/platforms/ios/MyProject/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m:7:9: fatal error: 
      'Firebase.h' file not found
#import "Firebase.h"
        ^~~~~~~~~~~~
1 error generated.

** ARCHIVE FAILED **

The following build commands failed:
    CompileC /Users/myUser/Library/Developer/Xcode/DerivedData/MyProject-dwfxupwwzcbssmamqfftsijvblyb/Build/Intermediates.noindex/ArchiveIntermediates/MyProject/IntermediateBuildFilesPath/MyProject.build/Release-iphoneos/MyProject.build/Objects-normal/armv7/FCMPlugin.o MyProject/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
(node:8380) UnhandledPromiseRejectionWarning: Error: xcodebuild: Command failed with exit code 65
    at ChildProcess.whenDone (/mobile/node_modules/cordova-common/src/superspawn.js:135:23)
    at ChildProcess.emit (events.js:197:13)
    at maybeClose (internal/child_process.js:984:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
(node:8380) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8380) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.