异常-调用时抛出了无法识别的选择器发送给实例

时间:2018-10-23 14:24:14

标签: ios react-native cocoapods

有人知道该异常的含义以及如何解决该异常吗?

Exception - unrecognized selector sent to instance was thrown while invoking addNetworkingHandler on target BlobMdule with params ()

screenshot

由于新版本的react-native-firebase,它在我将React添加到Podfile后出现。我是否必须首先从XCode项目“取消链接” React,将React添加到Podfile,然后运行pod install?我在网络上找不到任何有关如何解决问题的建议的教程或文档。

感谢您的帮助:D

我的Podfile:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'DasHGR' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for DasHGR

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    # the following ones are the ones taken from "Libraries" in Xcode:
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'RNFS', :path => '../node_modules/react-native-fs'

  target 'DasHGRTests' do
    inherit! :search_paths
    # Pods for testing
  end

  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.9.0'
  pod 'Firebase/Messaging', '~> 5.9.0'
  pod 'Fabric', '~> 1.7.11'
  pod 'Crashlytics', '~> 3.10.7'
  # pod 'Firebase/Performance', '~> 5.9.0'

  # The following is needed to ensure the "archive" step works in XCode.
  # It removes React from the Pods project, as it is already included in the main project.
   post_install do |installer|
      installer.pods_project.targets.each do |target|
          if target.name == "React"
              target.remove_from_project
          end
      end
  end

end

target 'DasHGR-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for DasHGR-tvOS

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

end

1 个答案:

答案 0 :(得分:1)

回应@Kubwimana Adrien评论

实际上我不知道我到底做了什么,但是现在我的Pofile看起来像这样:

我将yoga添加到了在构建时应该忽略的目标...希望对您有帮助

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'DasHGR' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for DasHGR
  # Add new pods below this line

  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    # the following ones are the ones taken from "Libraries" in Xcode:
    'RCTAnimation',
    'RCTActionSheet',
    # 'RCTBlob',
    # 'RCTGeolocation',
    'RCTImage',
    # 'RCTLinkingIOS',
    'RCTNetwork',
    # 'RCTSettings',
    'RCTText',
    # 'RCTVibration',
    'RCTWebSocket'
  ]

  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'MerryPhotoViewer', path: '../node_modules/@merryjs/photo-viewer'

  # target 'DasHGRTests' do
    # inherit! :search_paths
    # Pods for testing
  # end

  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.9.0'
  pod 'Firebase/Messaging', '~> 5.9.0'
  pod 'Fabric', '~> 1.7.11'
  pod 'Crashlytics', '~> 3.10.7'
  pod 'Firebase/Performance', '~> 5.9.0'

  # The following is needed to ensure the "archive" step works in XCode.
  # It removes React from the Pods project, as it is already included in the main project.
  post_install do |installer|
      installer.pods_project.targets.each do |target|

          targets_to_ignore = %w(React yoga RNFS) # <---- added yoga (and also RNFS)

          if targets_to_ignore.include? target.name
              target.remove_from_project
          end
      end
  end

end

target 'DasHGR-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for DasHGR-tvOS

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

end