Получение «Необработанного JS Исключение: собственный модуль не может быть нулевым» Ошибка при IOS времени выполнения с React Native - PullRequest
1 голос
/ 26 апреля 2020

Подготовка приложения производственного уровня среднего размера для IOS.

Приложение использует множество встроенных возможностей и некоторые попытки попытаться объединить некоторые из них, которые я перешел на использование Cocoapods, вручную, используя файл Podfile.

Это помогло мне преодолеть все сбои сборки и, наконец, могло запустить приложение RN.

Только сейчас, появилась очень расплывчатая ошибка:

Unhandled JS Exception: Native module cannot be null

Трудно понять, какой сторонний пакет вызывает это .. куча проблем git указывают на добавление нужного пакета в файл Podfile и pod install, что я и сделал, но все же не радость.

Это проблемы `git, большинство из них в специальном c пакете:

Большинство из них в значительной степени решают эту проблему, добавляя в файл Podfile правильную ссылку pod и запуская pod install - это не сработало для я

Вещи я пробовал:

  • Удаление двоичных ссылок, но JavaScriptCore.framework и libPods-myProjectName.a
  • Очистка Libraries от всех пакетов .xcodeproj для устранения дублирующихся ссылок
  • Очистил проект, перестроил, очистил пакеты с pod deintegrate и переустановил .. в основном очистил и переустановил все, что мог
  • Обновил react-native с 0.58.6 до 0.59.9

После этого сообщения в блоге для преобразования моего существующего проекта в использование Cocoapods `

Установка Pod проходит без ошибок - pod install output:

Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing AppAuth (1.3.0)
Installing BugsnagReactNative (2.23.1)
Installing DoubleConversion (1.1.6)
Installing Folly (2018.10.22.00)
Installing RNDeviceInfo (2.3.2)
Installing RNGestureHandler (1.1.0)
Installing RNSVG (9.5.1)
Installing RNShare (3.0.0)
Installing RNSound (0.11.0)
Installing RNVectorIcons (6.6.0)
Installing React (0.59.9)
Installing ReactNativePermissions (1.1.1)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.5)
Installing react-native-camera (2.1.1)
Installing react-native-image-picker (0.28.1)
Installing react-native-image-resizer (1.2.0)
Installing react-native-keep-awake (4.0.0)
Installing react-native-netinfo (3.2.1)
Installing react-native-orientation (3.1.3)
Installing react-native-view-shot (3.1.2)
Installing react-native-webview (5.7.0)
Installing yoga (0.59.9.React)
Installing ReactNativeNFC (1.0.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 31 dependencies from the Podfile and 23 total pods installed.

И Podfile:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '9.0'

target 'myProjectName' do
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTText',
    'RCTImage',
    'RCTNetwork',
    'RCTWebSocket',
    'RCTSettings',
    'RCTAnimation',
    'RCTLinkingIOS',
    # Add any other subspecs you want to use in your project
    # Remove any subspecs you don't want to use in your project
  ]

  pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
  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 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'RNSound', :path => '../node_modules/react-native-sound'
  pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
  pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
  pod 'react-native-orientation', :path => '../node_modules/react-native-orientation'

  # permissions_path = '../node_modules/react-native-permissions/ios'
  # pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"

  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
  pod 'RNShare', :path => '../node_modules/react-native-share'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'react-native-view-shot', :path => '../node_modules/react-native-view-shot'
  pod 'AppAuth'
  pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'
  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
  pod 'ReactNativeNFC', :path => '../node_modules/react-native-rfid-nfc-scanner/ios'

end

И мой dependancies внутри package.json:

  "dependencies": {
    "@react-native-community/netinfo": "3.2.1",
    "axios": "0.18.0",
    "bugsnag-react-native": "2.23.1",
    "country-list": "2.1.1",
    "formik": "1.5.1",
    "link": "^0.1.5",
    "moment": "2.24.0",
    "react": "16.6.3",
    "react-native": "0.59.9",
    "react-native-android-location-enabler": "^1.1.0",
    "react-native-android-wifi": "0.0.41",
    "react-native-app-auth": "^4.4.0",
    "react-native-camera": "2.1.1",
    "react-native-collapsible": "1.4.0",
    "react-native-country-picker-modal": "0.7.1",
    "react-native-device-info": "2.3.2",
    "react-native-fs": "^2.16.4",
    "react-native-gesture-handler": "1.1.0",
    "react-native-image-picker": "0.28.1",
    "react-native-image-resizer": "^1.2.0",
    "react-native-keep-awake": "^4.0.0",
    "react-native-linear-gradient": "2.5.4",
    "react-native-orientation": "3.1.3",
    "react-native-permissions": "1.1.1",
    "react-native-pinch-zoom-responder": "^0.1.2",
    "react-native-qrcode-scanner": "1.1.2",
    "react-native-rfid-nfc-scanner": "github:avshalomp/react-native-rfid-nfc#fix/nfc_infrastructure",
    "react-native-share": "^3.0.0",
    "react-native-smooth-pincode-input": "1.0.3",
    "react-native-sound": "^0.11.0",
    "react-native-status-bar-height": "2.3.1",
    "react-native-svg": "9.5.1",
    "react-native-svg-charts": "5.2.0",
    "react-native-swipe-gestures": "1.0.3",
    "react-native-swiper": "^1.5.14",
    "react-native-vector-icons": "6.6.0",
    "react-native-view-shot": "^3.1.2",
    "react-native-webview": "^5.7.0",
    "react-native-wifi": "1.0.1",
    "react-navigation": "3.3.2",
    "react-navigation-transitions": "1.0.10",
    "react-redux": "6.0.1",
    "redux": "4.0.1",
    "redux-persist": "5.10.0",
    "redux-saga": "1.0.2",
    "reselect": "4.0.0",
    "styled-components": "4.1.3",
    "yup": "0.26.10"
  }

Мой текущий env:

   React: 16.6.3,
   React Native: 0.59.9 // tested with React Native 0.58.6 too
   Xcode: 11.4.1

Действительно трудно отладить это, так как ошибки React Native не очень полезны, плюс, возможно, что-то упущено

Есть идеи, как получить больше информации об этом?

Или как решить эту проблему?

Помогите ..

1 Ответ

1 голос
/ 26 апреля 2020

Добавьте это в ваш подфайл:

pod 'ReactNativeNFC', :path => "../node_modules/react-native-rfid-nfc/ios"

, затем:

pod install

Если я найду новый неустановленный компонент, я добавлю сюда.

...