【问题标题】:Exception - unrecognized selector sent to instance was thrown while invoking异常 - 发送到实例的无法识别的选择器在调用时被抛出
【发布时间】:2018-10-23 14:24:13
【问题描述】:

有谁知道这个异常是什么意思以及如何解决它?

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

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

感谢您的帮助:D

我的播客文件:

# 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

【问题讨论】:

  • 你是如何解决这个问题的?将 firebase 添加到 podfile 后,我遇到了同样的问题。
  • @KubwimanaAdrien 看看我的回复stackoverflow.com/a/54316600/6489268 是否有帮助...?!

标签: ios react-native cocoapods


【解决方案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

【讨论】:

  • 你的 podfile 看起来更像我的。我已经尝试了一切,但没有运气。我不断收到这些错误。如果您了解他们,请提供帮助。谢谢! i.stack.imgur.com/8MhG5.pngi.stack.imgur.com/tILKE.png
  • @KubwimanaAdrien 你试过删除 Pods 文件夹和 node_modules 文件夹,重新安装 Pods 和模块并清理 Xcode 缓存吗?看起来 Native Modules Form React Native 本身没有正确加载。我还用 Xcode 中的库更改了链接二进制文件列表的顺序,我认为这样 RNFirebase 库位于列表底部,所有 React Native 库位于顶部
  • @KubwimanaAdrien 这是当前列表:https://i.imgur.com/o1DLCit.png
  • 感谢您的帮助。我能够解决这个问题。我所做的只是手动链接 RCTNetwork。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-27
  • 1970-01-01
  • 1970-01-01
  • 2019-08-28
  • 2012-07-24
相关资源
最近更新 更多