@ react-native-firebase / admob在IOS中不起作用

时间:2020-09-18 17:17:45

标签: react-native react-native-ios react-native-firebase

我正在使用 @ react-native-firebase / admob 来显示应用上的添加。在Android上运行正常,但是当我在ios上使用它时,应用程序崩溃并出现以下错误。

ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator'
Undefined symbols for architecture x86_64:
  "___isPlatformVersionAtLeast", referenced from:
      -[APMMeasurement reportFirstOpenOnWorkerQueue] in GoogleAppMeasurement(APMMeasurement_d6638b533a7cdc437824cf7209ad695a.o)
      -[APMSqliteStore prepareSQL:error:] in GoogleAppMeasurement(APMSqliteStore_acc99dfbcd8c054676308fb24061e3f7.o)
      +[APMASIdentifierWrapper iOS14OrAbove] in GoogleAppMeasurement(APMASIdentifierWrapper_1d59db0ddd97263057318367c9cd40e6.o)
      -[APMIdentity supportsAppTrackingConsentStatus] in GoogleAppMeasurement(APMIdentity_ba0d5d0b5e35834ab5a7bf0571075715.o)
      -[APMMeasurement(URL) sendDeepLinkURLToAppDelegateOnMainThread:extraInfo:] in GoogleAppMeasurement(APMMeasurement+URL_89002570063d654e31cbed7a49d52cf9.o)
      l002 in GoogleMobileAds(GADAugmentedRealitySignalSource.o)
      _GADWindowSceneForViewController in GoogleMobileAds(GADScene.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang:
error: linker command failed with exit code 1 (use -v to see invocation)


** BUILD FAILED **


The following build commands failed:
        Ld /Users/admin/Library/Developer/Xcode/DerivedData/adMob-govjzfsolrnouaecgeggequoemrv/Build/Products/Debug-iphonesimulator/adMob.app/adMob normal x86_64
(1 failure)

adMob是我的项目名称。我按照所有说明进行安装。

package.json

{
  "name": "adMob",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-firebase/admob": "^7.6.5",
    "@react-native-firebase/app": "^8.4.3",
    "react": "16.13.1",
    "react-native": "0.63.2"
  },
  "devDependencies": {
    "@babel/core": "7.11.6",
    "@babel/runtime": "7.11.2",
    "@react-native-community/eslint-config": "1.1.0",
    "babel-jest": "25.5.1",
    "eslint": "6.8.0",
    "jest": "25.5.4",
    "metro-react-native-babel-preset": "0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'adMob' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  
  pod 'RNFBAdMob', :path => '../node_modules/@react-native-firebase/admob'

  target 'adMobTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'adMob-tvOS' do
  # Pods for adMob-tvOS

  target 'adMob-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

我还在根文件夹中添加了 firebase.json 文件

2 个答案:

答案 0 :(得分:0)

完成RND之后,我发现这是Xcode版本问题。我正在使用Xcode 10,并且可以在Xcode 11和更高版本上使用。所以这就是为什么我要面对这个问题。

答案 1 :(得分:0)

是的。如果您没有获得广告,则只能存档。那么它主要是许可问题。您还应该检查您在 react native admod 中实现的 google ad mod 密钥是否正确。