Description:
I updated React native OneSignal from 3.2.12 version to 3.3.2 version, after that I started getting error during app launch.
(your description here)
Environment
Steps to Reproduce Issue:
Anything else:
(crash stacktraces, as well as any other information here)
Here is my code:
import OneSignal from 'react-native-onesignal';
initialize() {
OneSignal.init(config.oneSignalAppId, {kOSSettingsKeyAutoPrompt : false});
OneSignal.inFocusDisplaying(0);
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', this.onIds);
OneSignal.configure();
}
Here is the full error stack trace:
NOneSignal.configure is not a function. (In 'RNOneSignal.configure()', 'RNOneSignal.configure' is undefined)
- node_modules/react-native-onesignal/index.js:97:12 in addEventListener
* src/tracking/PushNotificationService.js:24:35 in initialize
* src/App.js:37:4 in App
- node_modules/react-proxy/modules/createClassProxy.js:98:23 in
- node_modules/react-proxy/modules/createClassProxy.js:96:6 in instantiate
OneSignal.configure() was depreciated at the previous version.
It would be called automatically.
Hm, weird, but on OneSignal React Native SDK setup guide it still says, that we need to use OneSignal.configure();

When I'm removing OneSignal.configure(); I'm still getting an error:
RNOneSignal.configure is not a function
WasOneSignal.addEventListener('ids', this.onIds)deprecated a as well?
Hm, weird, but on OneSignal React Native SDK setup guide it still says, that we need to use
OneSignal.configure();
I believe the documentation is outdated. At 3.3.1 version, the configure() method was depreciated and at 3.3.2 version it was removed.
I am not sure about the ids event. It requires some clarification from one-signal.
@Luckygirlllll
As I know from 3.3.1, configure() method would be called automatically from ids event.
And I found this commit for 3.3.2 release. They changed configure() method name in native code.
I am not sure you need to run the pod update and pod install again after updating the onesign version in npm.
@OscarYuen it seems that in my case error throwsOneSignal.addEventListener('ids', this.onIds);, if I comment it, app works without error, however, I need this listener, because I use it to get device pushToken /
I removed OneSignal.configure(); from my code and removed configure() from node_modules/react-native-onesignal/index.js and app started work normally after that!
I will make sure the docs get updated. Thanks for bringin this up. The configure method is indeed deprecated. You don't need to call this anymore to trigger the 'ids' event as this gets triggered automatically
The docs have been updated. Cheers
I have same issue. When I upgrade to 3.5.0 and have this:
RNOneSignal.configure is not a function
Code:
OneSignal.init(oneSignalAppId, {
kOSSettingsKeyAutoPrompt: true,
kOSSettingsKeyInFocusDisplayOption: 0
});
OneSignal.addEventListener('received', onReceivedNotification);
OneSignal.addEventListener('opened', onOpenedNotification);
OneSignal.addEventListener('ids', onRegisteredIds);
I have just install from npm which steps am i missing?
@luutruong ,
You're definitely on an older version of the SDK. Make sure you updated correctly
@rgomezp How do i check if my version are latest? I see the Pod output.
Installing OneSignal 2.11.2 (was 2.10.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Is that latest version?
@rgomezp bump!
@luutruong ,
Yes, that's the latest iOS native version. But the issue is not on the native side, but rather on the Javascript side. You need to make sure you're using the latest React Native OneSignal SDK version.
Also, please include the entire stack trace, to get a better idea of what is going on
@rgomezp Quite strange. Now it's work fine.
@luutruong ,
strange. good to hear though! cheers
I had to go through I lot of process just to fix this "ids" issue.
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal/react-native-onesignal.podspec'
then pod install
after that I had to locate the OneSignalSDK inside "Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework" folder.
Drag "OneSignal.framework" in to my xcode
Most helpful comment
The docs have been updated. Cheers