【问题标题】:'React/RCTViewManager.h' file not found from FBSDK in react native 0.60在 react native 0.60 中未从 FBSDK 中找到“React/RCTViewManager.h”文件
【发布时间】:2019-09-10 13:26:07
【问题描述】:

我最近将 react-native 升级到了 0.60 版。结果,我的 Podfile 看起来像这样:

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

  # Pods for myProject
   # this is very important to have!
    rn_path = '../node_modules/react-native'

    pod 'React', :path => '../node_modules/react-native'
    pod 'React-Core', :path => '../node_modules/react-native/React'
    pod 'React-DevSupport', :path => '../node_modules/react-native/React'
    ...
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'

其中一个项目依赖项是 FBSDK,如上所示。 问题是这种依赖依赖于 React pod 而不是 React-Core,所以构建失败是因为使用路径 React/Module 找不到某些模块:

Xcode,文件 RCTFBSDKMessageDialog.h(来自 pod react-native-fbsdk):

#import <React/RCTBridgeModule.h>
#import <FBSDKShareKit/FBSDKShareKit.h>

@interface RCTFBSDKMessageDialog : NSObject <RCTBridgeModule>
@end

我收到错误:error 'React/RCTBridgeModule.h' file not found

如果我将它更改为 React-Core/React/RCTBridgeModule.h 它可以工作。

有什么想法可以在不重命名所有引用的情况下使其工作?

【问题讨论】:

    标签: ios react-native react-native-ios react-native-fbsdk


    【解决方案1】:

    我终于解决了。

    问题出在 Podfile 上,最后一部分是从 ios 项目目标中删除 React(我之前的 React 版本有这个):

      post_install do |installer|
        installer.pods_project.targets.each do |target|
          if target.name == "React"
            target.remove_from_project
          end
        end
      end
    

    我还必须添加这些行(来自React Native Upgrade helper):

    require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
    
    ...
    
    use_native_modules!
    

    所以,总而言之,问题在于升级到 0.60 后,Podfile 没有正确升级,因此没有将 React 模块添加到 iOS 目标中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-10
      • 1970-01-01
      • 2018-05-20
      • 1970-01-01
      • 2018-09-10
      相关资源
      最近更新 更多