【问题标题】:react-native-share on iOS get cannot read property 'FACEBOOK' of undefinediOS 上的 react-native-share 无法读取未定义的属性“FACEBOOK”
【发布时间】:2020-05-06 10:47:46
【问题描述】:

当我开始使用 react-native-share 时,我在 iOS 模拟器中收到此错误

cannot read property 'FACEBOOK' of undefined
RNShare
index.js:208:36
...

运行后 npm install 我跑cd ios/ && pod install

这是package.json 部分

"dependencies": {
    "@react-native-community/datetimepicker": "2.2.2",
    "jetifier": "^1.6.5",
    "react": "16.12.0",
    "react-native": "0.61.5",
    "react-native-base64": "0.0.2",
    "react-native-device-info": "3.1.4",
    "react-native-gesture-handler": "1.4.1",
    "react-native-modal-datetime-picker": "8.5.1",
    "react-native-screens": "^2.7.0",
    "react-native-share": "^3.3.0",
    "react-native-vector-icons": "6.6.0",

这是一个 Podfile 部分

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'mobile' do

  ...

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

  ...

  pod 'RNShare', :path => '../node_modules/react-native-share'

【问题讨论】:

标签: ios react-native share


【解决方案1】:

由于您使用的是 RN 版本 0.61,因此您不必在 podfile 中手动添加 RNShare

  1. 从 pod 文件中删除 pod 'RNShare', :path => '../node_modules/react-native-share'
  2. 删除pods文件夹和ios文件夹内的podlock文件
  3. 再次运行pod install

https://github.com/react-native-community/react-native-share#automatic-way

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-27
    相关资源
    最近更新 更多