react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps
Getting this error even without expo
React Native Version: "react-native": "^0.59.8",
"react-native-permissions": "^2.0.9",
Installed and followed manual linking instructions.Still getting the same error.
@BasilJohn I got the same error until I add the Podfile for notification without add Info.plist
@BasilJohn I got the same error until I add the Podfile for notification without add Info.plist
@dgana what about android ?
@dgana can you please tell me how to fixed it on IOS?
until I add the Podfile for notification without add Info.plist--I did not get this line
@BasilJohn Follow this part of the documentation: https://github.com/react-native-community/react-native-permissions/blob/master/README.md#-manual-linking
@BasilJohn But i'm still getting an error when i add Podfile pod 'Permission-Notifications', :path => "../node_modules/react-native-permissions/ios/Notifications.podspec"
NativeFirebaseError: [messaging/unknown] no valid “aps-environment” entitlement string found for application
at FirebaseMessagingModule.requestPermission (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:164729:28)
at registerForPushNotificationsAsync$ (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:159780:77)
at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25461:19)
at Generator.invoke [as _invoke] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25637:24)
at Generator.prototype.<computed> [as next] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25504:23)
at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25461:19)
at invoke (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25537:22)
at http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:25567:13
at tryCallTwo (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:26826:7)
I'm trying to add "@react-native-firebase/messaging": "^6.3.4" actually but got the error below. And so I have to install "react-native-permissions": "^2.0.10"
2020-03-20 18:38:56.311 [error][tid:com.facebook.react.JavaScript] Error: react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps:
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
* If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README.
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-permissions
But still no luck. My Android remote notification still works very well btw using firebase server
see https://github.com/invertase/react-native-firebase/issues/2657
The first error is not related to this lib: https://stackoverflow.com/a/33015254
For the second one, please submit your Podfile
@BasilJohn Follow this part of the documentation: https://github.com/react-native-community/react-native-permissions/blob/master/README.md#-manual-linking
@zoontek tried this..but I get the same error
@BasilJohn Did you clean your Xcode cache after correctly linking the lib?
@BasilJohn Did you clean your Xcode cache after correctly linking the lib?
Im getting this in android ..haven't looked into iOS yet
@BasilJohn Did you clean your Xcode cache after correctly linking the lib?
Im getting this in android ..haven't looked into iOS yet
Your Gradle cache then? Uninstall the app, clean and build it again.
Currently i got this error below
Error: Notifications permission pod is missing
at Object.fn [as requestNotifications] (NativeModules.js:99)
at requestNotifications (index.js:145)
at registerForPushNotificationsAsync$ (index.js:32)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:274)
at Generator.prototype.<computed> [as next] (runtime.js:97)
at tryCatch (runtime.js:45)
at invoke (runtime.js:135)
at runtime.js:145
at tryCallOne (core.js:37)
Podfile
pod 'Permission-Notifications', :path => "../node_modules/react-native-permissions/ios/Notifications.podspec"
What's the prerequisite for remote notification iOS btw?
Thank you for the lib
@dgana Are you, by any chance, using Expo?
@zoontek no i'm not using expo. running on real device iOS 13
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-permissions": "^2.0.10"
@dgana Give your complete Podfile, not just one line
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'GasSensorApp' do
# Pods for GasSensorApp
pod 'Permission-Notifications', :path => "../node_modules/react-native-permissions/ios/Notifications.podspec"
pod 'FBLazyVector', :path => '../node_modules/react-native/Libraries/FBLazyVector'
pod 'FBReactNativeSpec', :path => '../node_modules/react-native/Libraries/FBReactNativeSpec'
pod 'RCTRequired', :path => '../node_modules/react-native/Libraries/RCTRequired'
pod 'RCTTypeSafety', :path => '../node_modules/react-native/Libraries/TypeSafety'
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 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => '../node_modules/react-native/ReactCommon'
pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
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'
target 'GasSensorAppTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'GasSensorApp-tvOS' do
# Pods for GasSensorApp-tvOS
target 'GasSensorApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
@dgana If you run pod install, try closing Xcode, delete the DerivedData folder: https://stackoverflow.com/a/18933382
@zoontek done already now my error is
NativeFirebaseError: [messaging/unregistered] You must be registered for remote notifications before calling get token, see messaging().registerForRemoteNotifications() or requestPermission().
at FirebaseMessagingModule.getToken (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:160608:28)
at registerForPushNotificationsAsync$ (http://192.168.0.187:8081/src/screen/Home/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:98:77)
at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29245:19)
at Generator.invoke [as _invoke] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29421:24)
at Generator.prototype.<computed> [as next] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29288:23)
at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29245:19)
at invoke (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29321:22)
at http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29331:15
at tryCallOne (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:3244:14)
My code
import messaging from '@react-native-firebase/messaging';
const registerForPushNotificationsAsync = async () => {
try {
messaging().registerForRemoteNotifications();
const hasPermission = await messaging().hasPermission();
console.log('HAS PERMISSION ', hasPermission);
if (hasPermission) {
await requestNotifications(['alert', 'badge', 'sound']);
const apnToken = await messaging().getAPNSToken();
console.log('APN TOKEN ', apnToken);
const fcmToken = await messaging().getToken();
console.log('FCM TOKEN ', fcmToken);
} else {
await messaging().requestPermission();
console.log('REQUEST PERMISSION');
}
} catch (error) {
console.log(error);
}
};
I have no idea sorry. Can you show me maybe how you handle to get the FCM token?. If i put await in messaging().registerForRemoteNotifications(); the code below doesn't run.
My status is granted when calling await requestNotifications([
'alert',
'badge',
'sound',
])
@dgana This is a totally different error than the one issued. Next time consider seriously creating a new issue instead of publishing in other ones, it will be less confusing.
Requesting the notification permission already register your app for remote notifications.
You mix react-native-permissions handlers and other libs for checking/requesting permissions. As system permissions APIs are…hum…bad, we have to store requested one in app storage, and the other libs ignore that (same the other way).
// this is enough to get the token, normally
const getToken = (): Promise<string | void> =>
requestNotifications(["alert"])
.then(({ status }) => (status === RESULTS.GRANTED ? messaging().getToken() : Promise.resolve()))
.catch(error => console.error(error));
@zoontek Okay noted Thanks!
I am new to react native and I am trying to run an existing project. My project doesn't use PodFile. When I try to build the project using Xcode, it builds fine but crashes with the below error. Please assist:
[error][tid:com.facebook.react.JavaScript] react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps:
• If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
here is the version info:
react-native-cli: 2.0.1
react-native: 0.59.5
node: v10.17.0
package.json dependencies:
"dependencies": {
"@react-native-community/async-storage": "^1.6.2",
"radio-button-react-native": "^1.1.6",
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-animatable": "^1.3.3",
"react-native-camera": "^2.5.0",
"react-native-datepicker": "^1.7.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-permissions": "^1.1.1",
"react-native-qrcode-scanner": "^1.2.3",
"react-native-reanimated": "^1.7.0",
"react-native-screens": "^2.4.0",
"react-native-splash-screen": "^3.2.0",
"react-navigation": "^3.1.3",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0"
}
@amdixit You need at least Cocoapods to link permissions handlers. Follow https://github.com/react-native-community/react-native-permissions#-manual-linking to link the library core. I'm closing this since the original issue is "solved". It's not directly an issue with the lib, but a bad install / bad cache state.
You can find a lot of infos on multiples React Native libraries, like this one.
@zoontek done already now my error is
NativeFirebaseError: [messaging/unregistered] You must be registered for remote notifications before calling get token, see messaging().registerForRemoteNotifications() or requestPermission(). at FirebaseMessagingModule.getToken (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:160608:28) at registerForPushNotificationsAsync$ (http://192.168.0.187:8081/src/screen/Home/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:98:77) at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29245:19) at Generator.invoke [as _invoke] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29421:24) at Generator.prototype.<computed> [as next] (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29288:23) at tryCatch (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29245:19) at invoke (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29321:22) at http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:29331:15 at tryCallOne (http://192.168.0.187:8081/index.bundle?platform=ios&dev=true&minify=false:3244:14)My code
import messaging from '@react-native-firebase/messaging'; const registerForPushNotificationsAsync = async () => { try { messaging().registerForRemoteNotifications(); const hasPermission = await messaging().hasPermission(); console.log('HAS PERMISSION ', hasPermission); if (hasPermission) { await requestNotifications(['alert', 'badge', 'sound']); const apnToken = await messaging().getAPNSToken(); console.log('APN TOKEN ', apnToken); const fcmToken = await messaging().getToken(); console.log('FCM TOKEN ', fcmToken); } else { await messaging().requestPermission(); console.log('REQUEST PERMISSION'); } } catch (error) { console.log(error); } };I have no idea sorry. Can you show me maybe how you handle to get the FCM token?. If i put await in
messaging().registerForRemoteNotifications();the code below doesn't run.My status is
grantedwhen callingawait requestNotifications([ 'alert', 'badge', 'sound', ])
And how did you do it?
ANDROID
react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps
Getting this error even without expo
$ react-native info
info Fetching system and libraries information...
(node:36570) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
System:
OS: macOS 10.15.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 247.81 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.2.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.8.4 - /Applications/MAMP/Library/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Python: 2.7.13 - /Applications/MAMP/Library/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
react-native: Not Found
@BasilJohn Did you clean your Xcode cache after correctly linking the lib?
Im getting this in android ..haven't looked into iOS yet
Your Gradle cache then? Uninstall the app, clean and build it again.
did not help
I'm getting this error on android
@zoontek
any idea?
ANDROID
react-native-permissions: NativeModule.RNPermissions is null. To fix this issue try these steps
Getting this error even without expo
Try it with the example. This is always the result of incorrect project integration, and the example is integrated correctly so it should work and prove it works. If it works and your project does not work, examine the auto-linking configuration in your android build.gradle files.
Hello @oleg-moseyko , I managed to solve it in my case. React-native-permissions is dependent on another library that I use. When adding react-native-permissions as a project dependency the error disappeared.
@mikehardy
project works well if i deploy it to other ubuntu pc but on mac i get this bullshit only for android (ios ok)
am getting the same error message (without manual linking) and this fixed it for me https://github.com/zoontek/react-native-permissions/issues/324#issuecomment-538768035
@dgana Are you, by any chance, using Expo?
Im using expo and i get this error react-native permissions:NativeModule.RNPermissions is null. Im using android device
shows loadmodukleImplementation under call stack guarded load module
@zoontek Hi I am using expo. and also getting this error. I don't have any package which needs linking. still getting this error. Please help.
my package.json look like this
{
"name": "RNFoodDeliveryDriver",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@pusher/chatkit-client": "^1.13.1",
"@react-native-community/netinfo": "^4.4.0",
"axios": "^0.19.0",
"expo": "36.0.0",
"pusher-js": "^5.0.2",
"react": "16.9.0",
"react-native": "0.61.2",
"react-native-config": "^0.11.7",
"react-native-geocoding": "^0.4.0",
"react-native-geolocation-service": "^3.1.0",
"react-native-gesture-handler": "^1.4.1",
"react-native-gifted-chat": "^0.11.0",
"react-native-maps": "0.25.0",
"react-native-maps-directions": "^1.7.3",
"react-native-modal": "^11.4.0",
"react-native-permissions": "^3.0.1",
"react-native-pusher-push-notifications": "git+http://[email protected]/ZeptInc/react-native-pusher-push-notifications#v.2.4.0-zept-master",
"react-native-reanimated": "^1.3.0",
"react-native-screens": "^1.0.0-alpha.23",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.9.4"
},
"devDependencies": {
"@babel/core": "^7.6.3",
"@babel/runtime": "^7.6.3",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Is there any update about this issue? I'm getting the same error in Android.
@Luckygirlllll This error doesn't really exists / happen. If it happen, it means that:
1) The module is not correctly linked
2) You can't use native modules (ex: non-bare Expo)
3) You perform tests and you forgot to mock the native module
@zoontek this issue kind of exist because, I'm not using linking, because I'm using "react-native": "0.63.4", so all linking is done automatically, I don't use Expo, I don't do tests.
However, I got errors during the install, because react-native-permissions was complaining that I don't have latest version of RN, so during install I used --legacy-peer-deps, I'm wonder is that could cause a problem.

@Luckygirlllll --legacy-peer-deps cannot bring this issue, it's just about silencing a warning.
Did you perform a pod install / clean the build caches before running your app again?
@zoontek Yes, IOS is working correctly, the problem is only with Android.
@Luckygirlllll OK, similarly, did you cleaned the Gradle cache? (check https://github.com/pmadruga/react-native-clean-project)
@zoontek yes, multiple times.
@Luckygirlllll Ok, then publish a reproduction repository because we are not able to reproduce this.
This is always and forever an auto-linking problem. Perhaps build.gradle is missing the call out to the react-native CLI gradle. It's definitely not a problem with the module, it's a problem with the project every single time
Most helpful comment
I'm getting this error on android