-[FBLPromise HTTPBody]:发送到实例的无法识别的选择器

-[FBLPromise HTTPBody]: unrecognized selector sent to instance

在 ios 应用程序中使用 Firebase Analytics,在 phone 和模拟器上使用 ios 15.4,XCode 13.2.1 (13C100) 在 React Native 应用程序中. 该应用程序本身可以运行,但是当我尝试添加单元测试时,测试运行程序因无法识别的选择器问题而失败。我已经梳理了 SO 上的问题,他们要么要求更多信息并死在藤蔓上,要么在 Firebase github.

上引用相同的四个问题

Podfile(下)没有 use_frameworks!所以重复的符号不太可能是罪魁祸首。我尝试了 github 问题中的一条具体建议,pod deintegrate 并重新创建 Podfile.lock,但无济于事。

这是崩溃日志,下面是 Podfile:

2022-02-01 17:59:06.733484-0800 ******[15233:34721677] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600003d17db0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000011356eba4 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x000000010dee1be7 objc_exception_throw + 48
    2   CoreFoundation                      0x000000011357d811 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x00000001135730ac ___forwarding___ + 1433
    4   CoreFoundation                      0x00000001135751d8 _CF_forwarding_prep_0 + 120
    5   ******                            0x00000001004111a0 -[GDTCCTUploadOperation updateNextUploadTimeWithResponse:forTarget:] + 96
    6   ******                            0x00000001004105ca __64-[GDTCCTUploadOperation sendURLRequestWithBatch:target:storage:]_block_invoke + 74
    7   ******                            0x000000010044ad65 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.67 + 85
    8   ******                            0x000000010044a62a __44-[FBLPromise observeOnQueue:fulfill:reject:]_block_invoke_2 + 106
    9   libdispatch.dylib                   0x000000011147965a _dispatch_call_block_and_release + 12
    10  libdispatch.dylib                   0x000000011147a83a _dispatch_client_callout + 8
    11  libdispatch.dylib                   0x0000000111480f2d _dispatch_lane_serial_drain + 1032
    12  libdispatch.dylib                   0x00000001114819d0 _dispatch_lane_invoke + 400
    13  libdispatch.dylib                   0x000000011148c57d _dispatch_workloop_worker_thread + 772
    14  libsystem_pthread.dylib             0x0000000114c1745d _pthread_wqthread + 314
    15  libsystem_pthread.dylib             0x0000000114c1642f start_wqthread + 15
)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/rmd6502/Library/Developer/Xcode/DerivedData/******-ezrzirhsblfqhfcbpxivqdehqlic/Build/Products/Debug-iphonesimulator DYLD_INSERT_LIBRARIES=/Users/rmd6502/Library/Developer/Xcode/DerivedData/******-ezrzirhsblfqhfcbpxivqdehqlic/Build/Products/Debug-iphonesimulator/******.app/Frameworks/libXCTestBundleInject.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib DYLD_FRAMEWORK_PATH=/Users/rmd6502/Library/Developer/Xcode/DerivedData/******-ezrzirhsblfqhfcbpxivqdehqlic/Build/Products/Debug-iphonesimulator
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600003d17db0'

播客文件:

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '14.0'

target '******' do
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask'
  pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :commit => '4f3c694920ed0f5d3a8e180aacaf3af40c2efb4a'
  pod 'Amplitude-iOS', '3.14.1'
  pod 'EDQueue', :git => 'https://github.com/*****/queue.git', :commit => '06307feabc8893dee182732ed9f7662dcee2c4e8'
  pod 'FMDB/standalone'
  pod 'OpenCV2', '4.0.1'
  pod 'TrueTime'
  pod 'Firebase/Performance'
  pod 'Firebase/ABTesting'

  # pod 'Firebase/CoreOnly'
  pod 'Firebase/MLVision'
  pod 'FirebaseAnalytics'

  
  pod 'GoogleMLKit/TextRecognition'

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # based on https://github.com/facebook/flipper/commit/42325e41c5b7a7173281e57cdc3bfb9aee76340d
  # TODO: add a RELEASE mode exemption too, or replace the CI check with it
  # if !ENV['CI']
  #   use_flipper!({ 'Flipper' => '0.75.1', 'Flipper-Folly' => '2.6.7', 'Flipper-RSocket' => '1.4.3', 'Flipper-DoubleConversion' => '3.1.7', 'Flipper-Glog' => '0.3.9', 'Flipper-PeerTalk' => '0.0.4' })
  #   post_install do |installer|
  #     flipper_post_install(installer)
  #     # based on 
  #     installer.pods_project.targets.each do |target|
  #       target.build_configurations.each do |config|
  #         config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
  #       end
  #     end
  #   end
  # end

  target '*****Tests' do
    inherit! :complete
  end```

Firebase/MLVision 已经弃用几年了,所以应用中可能混入了一些不兼容的版本。

最好的办法是更新到 GoogleMLKit。如果不是这样,您可以通过浏览生成的 Podfile.lock.

中的信息找到兼容的旧版本

实际问题是 inherit! :complete 因为测试目标是复制 Promise 库并导致崩溃。