GithubHelp home page GithubHelp logo

For IOS getting ERROR TypeError: null is not an object (evaluating 'NativeModule.requestPermission' about react-native-qrcode-scanner HOT 7 OPEN

praveenreddy9 avatar praveenreddy9 commented on May 27, 2024
For IOS getting ERROR TypeError: null is not an object (evaluating 'NativeModule.requestPermission'

from react-native-qrcode-scanner.

Comments (7)

stanjhae avatar stanjhae commented on May 27, 2024 23

After spending two days debugging react-native-permissions, I found the issue is with react-native-qrcode-scanner.

It has "react-native-permissions": "^2.0.2" in it's dependencies but the current version is "react-native-permissions": "^3.8.0".

This version of react-native-permissions (3.8.0) has breaking changes.

Quick fix

  1. Install react-native-permissions.
  2. Most importantly, remember to add "reactNativePermissionsIOS": ["Camera"] and "postinstall": "react-native setup-ios-permissions && pod-install" to your package.json.
  3. Run npm install.
  4. Delete node_modules/react-native-qrcode-scanner/node_modules/react-native-permissions because it installs the deprecated 2.0.2. (You'll need to do this each time you clear your node_modules).
  5. Your QR code scanner should be working again 🥳.

The postinstall goes in the scripts section of your package.json.
You'll also need "pod-install": "0.1.38".

If you still have issues, delete your node_modules, package.lock and run pod deintegrate. Then retry the steps.

PR Options

I can create a PR to fix this issue. We have two options:

  1. Take out the react-native-permissions dependency and update the readMe so everyone knows to install the dependency themselves and set it up properly.
  2. Update the dependency and add the necessary steps. (reactNativePermissionsIOS and postinstall).

Please react with 👍 for option 1 and 🚀 for option 2.

from react-native-qrcode-scanner.

stanjhae avatar stanjhae commented on May 27, 2024 2

Seem to have this error even after following the above steps on ios

duplicate symbol 'OBJC_CLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ duplicate symbol 'OBJC_METACLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ ld: 2 duplicate symbols for architecture x86_64

❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

Did you take out the prior react-native-permissions installation steps from your podfile?

In the past, you had to add the pods being used by react-native-permissions to your podfile. That's no longer needed.

from react-native-qrcode-scanner.

zoontek avatar zoontek commented on May 27, 2024 1

@stanjhae Option 1 is better since reactNativePermissionsIOS should be in user project package.json, couldn't be set in the library package.json.

The proper way to do it is to update this lib package.json like this:

"peerDependencies": {
  "react-native-permissions": "the-minimal-version-you-want-to-use"
},
"peerDependenciesMeta": {
  "react-native-permissions": {
    "optional": true
  }
}

from react-native-qrcode-scanner.

jalaliyev avatar jalaliyev commented on May 27, 2024

try this one:
react-native-permissions
You will also need to install react-native-permissions to handle camera related permissions

npm install react-native-permissions --save
react-native link react-native-permissions
For iOS, as part of the react-native-permissions setup you will need to add the following code to your Podfile

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
You may also need to reset your simulator data after adding those permissions Device -> Erase All Content and Settings...

More Info

from react-native-qrcode-scanner.

BraveEvidence avatar BraveEvidence commented on May 27, 2024

This will help you https://www.youtube.com/watch?v=sE0MEyFA7E4&list=PLQhQEGkwKZUrempLnmxjt7ZCZJu1W3p2i&index=10

from react-native-qrcode-scanner.

OpenTasteSG avatar OpenTasteSG commented on May 27, 2024

Seem to have this error even after following the above steps on ios

duplicate symbol 'OBJC_CLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ duplicate symbol 'OBJC_METACLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ ld: 2 duplicate symbols for architecture x86_64

❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

from react-native-qrcode-scanner.

Phong95 avatar Phong95 commented on May 27, 2024

Seem to have this error even after following the above steps on ios
duplicate symbol 'OBJC_CLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ duplicate symbol 'OBJC_METACLASS$_RNPermissionHandlerCamera' in

libPermission-Camera.a(RNPermissionHandlerCamera.o)
libRNPermissions.a(RNPermissionHandlerCamera.o)

❌ ld: 2 duplicate symbols for architecture x86_64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

Did you take out the prior react-native-permissions installation steps from your podfile?

In the past, you had to add the pods being used by react-native-permissions to your podfile. That's no longer needed.

i face same issue, follow your instruction, everything works now. You save my day, bro

from react-native-qrcode-scanner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.