1

Preparing a medium size production level app for IOS.

App uses a lot of native capabilities and and some point of attempting to integrate some of them I moved to using Cocoapods. manually using a Podfile file.

This helped me to over come all the build fails and could finally get the RN app running.

Only now, getting a very vague error:

Unhandled JS Exception: Native module cannot be null

Having a hard time to figure out which 3rd party package is causing this.. a bunch of git issues are pointing to add the right package to Podfile file and pod install which I did, but still not joy.

Those are the `git issues, most of them in a specific package:

Most of those pretty much solve this the same way by adding to Podfile file the right pod link and running pod install - this did not worked for me

Things that I've tried:

  • Removing binary links but JavaScriptCore.framework and libPods-myProjectName.a
  • Clearing Libraries from all .xcodeproj packages to resolve duplicated linking
  • Cleaned project rebuilt, cleared packages with pod deintegrate and reinstalled.. basically cleared and reinstalled everything I could
  • Upgrade react-native from 0.58.6 to 0.59.9

Followed this blog post to convert my existing project to use Cocoapods`

Pod install seems pass without any errors - 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.

And the 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

And my dependancies inside 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"
  }

My current env:

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

Really having hard time to debug this one as React Native errors are not so helpful, plus probably missing something

Any Ideas how to get more info about this one?

Or how to solve it?

Help..

7
  • 1
    When you say Profile you mean Podfile? To do pod install, you need a Podfile. Commented Apr 26, 2020 at 16:17
  • yes, sorry. was a bit in a hurry when uploaded this, plus still kinda new to IOS native stuff - edited it Commented Apr 26, 2020 at 17:09
  • No problem! which message pod install shows after installing? Commented Apr 26, 2020 at 17:13
  • its too long for the comments Iv'e added all the output of pod install to the main post Commented Apr 26, 2020 at 17:17
  • 1
    I added one answer to track new missing packages to install. Let's try to install each one. Commented Apr 26, 2020 at 17:44

1 Answer 1

1

Add this in your Podfile:

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

then:

pod install

If i find a new un-installed component, i'll add here.

Sign up to request clarification or add additional context in comments.

5 Comments

thanks, I just added it and installed still the same error. BTW, the .podspec file is inside the ios folder so the path is "../node_modules/react-native-rfid-nfc/ios"
You're right. I edited the answer. So, did you add react-native-wifi into Podfile? I can't see.
Tested it in the code, but now updated here and added the whole Podfile too.. it really starts to be an over content SO post :/
Yes, i just tried to give you a direction. Now, i think that some minutes investigating, you can find the missing dependencies to insert on Podfile. =)
thanks, although I went one by one.. added all of them still the same.. Im sure its something super small and silly iv'e missed.. thanks for you patience either way - highly appreciated :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.