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

问题描述 投票:0回答:3

在 iOS 应用程序中使用 Firebase Analytics,在手机和模拟器上使用 iOS 15.4,在 React Native 应用程序中使用 XCode 13.2.1 (13C100)。 应用程序本身可以工作,但是当我尝试添加单元测试时,测试运行程序因无法识别的选择器问题而失败。我已经梳理了 SO 上的问题,他们要么要求更多信息并中途夭折,要么在 Firebase 的 github 上引用相同的四个问题。

Podfile(如下)没有 use_frameworks!所以重复的符号不太可能是罪魁祸首。我尝试了 github issues 中的一条具体建议,

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'

Podfile:

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 https://stackoverflow.com/a/37289688/1983583
  #     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```
ios objective-c firebase firebase-analytics
3个回答
2
投票

实际问题是

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


1
投票

Firebase/MLVision
已被弃用几年,因此应用程序中可能混有一些不兼容的版本。

最好的办法是更新到 GoogleMLKit。如果不是这样,您也许可以通过探索生成的信息来找到兼容的旧版本

Podfile.lock


0
投票

虽然这是使用 Firebase 引起的另一个错误,但我能够解决该问题,这只是 XCTest 中导致崩溃的一个条件。

  • 遵循 Firebase 文档中的指导,将

    -ObjC
    添加到其他链接器标志(可在构建设置中找到)

  • 删除了新 XCTest 类的空

    testPerformance
    方法。

当我添加任何新的 XCTest 类并且崩溃始终存在时,第二步就被揭示了。删除它可以让测试运行

© www.soinside.com 2019 - 2024. All rights reserved.