【问题标题】:React Native: Unable to import React headers after updating to 0.60React Native:更新到 0.60 后无法导入 React 标头
【发布时间】:2020-03-04 16:38:09
【问题描述】:

更新到 React Native 0.60 后,标头链接不再起作用。

我在构建过程中从 React library 链接时遇到问题:

/Users/User/Developer/Project/node_modules/react-native-image-resizer/ios/RCTImageResizer/RCTImageResizer.m:12:9: fatal error: 'React/RCTImageLoader.h' file not found
#import <React/RCTImageLoader.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~

0.60 发生了什么变化:

  • 文件RCTImageLoader.h 现在位于/node_modules/react-native/React/CoreModules
  • 包含这些标头的文件 React.xcodeproj 不再存在

【问题讨论】:

    标签: ios xcode react-native react-native-linking ios-library


    【解决方案1】:

    我花了 3 个小时。终于找到了解决办法:

    通过运行命令使用特定版本 1.1.0:

    npm install react-native-image-resizer@1.1.0  
    

    然后运行命令:

    cd ios && pod install 
    

    【讨论】:

      【解决方案2】:

      many changes in React Native 0.60,其中一个主要的原因是 React 模块现在使用 CocoaPods 打包,它取代了 header 链接。

      我建议您在 0.60+ 中生成一个新项目并检查其项目结构(主要是 Podfile)。您也可以使用upgrade helper 来查看发生了什么变化。

      【讨论】:

        猜你喜欢
        • 2020-06-18
        • 2019-12-22
        • 2019-03-27
        • 2019-12-18
        • 1970-01-01
        • 1970-01-01
        • 2019-11-18
        • 1970-01-01
        • 2020-02-15
        相关资源
        最近更新 更多