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

7
在使用Firebase Analytics在ios应用中,使用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'

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://dev59.com/qloU5IYBdhLWcg3wvIqp#37289688
  #     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```

我已经修复了“FirebaseAnalytics”->“Firebase/Analytics”,以防版本不匹配,但也没有帮助。 - Robert Diamond
3个回答

2
实际问题是测试目标的 inherit! :complete 重复使用 Promise 库导致崩溃。

1

Firebase/MLVision已经弃用了几年,因此在应用程序中可能会混合一些不兼容的版本。

最好的方法是升级到GoogleMLKit。如果不能升级,您可以通过探索生成的Podfile.lock中的信息来找到兼容的旧版本。


0
虽然这是由于使用Firebase而引起的另一个错误,但我成功解决了这个问题,原因只是XCTest中的一个条件导致了崩溃。
  • 按照Firebase的文档中的指导,将-ObjC添加到其他链接器标志(在构建设置中找到)

  • 删除新的XCTest类中的空testPerformance方法。

当我添加任何新的XCTest类时,第二步就会显现出来,崩溃问题总是存在。删除它可以使测试运行正常。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接