React-native-onesignal: Doesn't work with In App Purchases

Created on 16 Nov 2020  ·  19Comments  ·  Source: OneSignal/react-native-onesignal

Description:
If an app has both IAP (react-native-iap 5.x.x+) and Onesignal. As soon as Onesignal.init is called app crashes. This is not an issue with react-native-iap version before 5.x.x

Environment

  1. What version of the OneSignal React-Native SDK are you using? 3.9.0
  2. How did you add the SDK to your project (eg. npm) npm

Steps to Reproduce Issue:

  1. install react-native-onesignal
  2. install react-native-iap (https://github.com/dooboolab/react-native-iap)
  3. call onesignal.init and app crashes with this message "d.b.a.a.c.f cannot be cast to d.b.a.a.a"
Not OneSignal Compatibility Issue Need More Information Possible Bug

Most helpful comment

Hi! I have exactly the same issue!

"react": "16.13.1"
"react-native": "0.63.3"
"react-native-onesignal": "^3.9.2"

Any solution?

All 19 comments

Howdy,
Can you please include a log with the OneSignal loglevel set to VERBOSE?

Cheers

2020-11-24 10:22:58.203 13843-14028/? E/unknown:ReactNative: CatalystInstanceImpl caught native exception
java.lang.ClassCastException: d.b.a.a.c.f cannot be cast to d.b.a.a.a
at com.onesignal.z2.(Unknown Source:62)
at com.onesignal.v1.Q(Unknown Source:9)
at com.onesignal.v1.a(Unknown Source:110)
at com.geektime.rnonesignalandroid.RNOneSignal.init(Unknown Source:41)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:149)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:919)
2020-11-24 10:22:58.203 13843-14028/? E/unknown:DisabledDevSupportManager: Caught exception
java.lang.ClassCastException: d.b.a.a.c.f cannot be cast to d.b.a.a.a
at com.onesignal.z2.(Unknown Source:62)
at com.onesignal.v1.Q(Unknown Source:9)
at com.onesignal.v1.a(Unknown Source:110)
at com.geektime.rnonesignalandroid.RNOneSignal.init(Unknown Source:41)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:149)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:919)

--------- beginning of crash

2020-11-24 10:22:58.203 13843-14028/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.bitapps.freshbit, PID: 13843
java.lang.ClassCastException: d.b.a.a.c.f cannot be cast to d.b.a.a.a
at com.onesignal.z2.(Unknown Source:62)
at com.onesignal.v1.Q(Unknown Source:9)
at com.onesignal.v1.a(Unknown Source:110)
at com.geektime.rnonesignalandroid.RNOneSignal.init(Unknown Source:41)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:149)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:919)

Hi! I have exactly the same issue!

"react": "16.13.1"
"react-native": "0.63.3"
"react-native-onesignal": "^3.9.2"

Any solution?

Hi

Any updates on this?

Howdy,
Unfortunately no updates yet. Thanks for your patience.

Hi
This is still a problem with the latest version as well 4.0.3

hey, same issue here. Any updates?

@rgomezp any updates about that? I need to release my app and the error keeps occurring

Any updates on this? this is a big blocker.

Howdy,

This is not an issue with react-native-iap version before 5.x.x

If this isn't an issue in older versions of react-native-iap, I would like to think the issue is with version 5+ of the same package.

I would recommend opening an issue with that package and downgrading to version 4 as a temporary workaround.

This sounds like a non-OneSignal issue.

If anyone has any information indicating otherwise, please share and we'll take a look.

Cheers

hey @rgomezp,

I made downgrade to version 3 but the problem still occurs.

You need to downgrade the other package.

@rgomezp So, you have the versions to I make a new test here?

The crash happens in one-signal not IAP and between IAP and OneSignal, IAP is more critical to the success of our product, so I think we'll have to migrate off one-signal since I doubt IAP will fix a crash in another package.

@mozadeh ,
How is this an issue with OneSignal given that it only started happening with react-native-iap versions _after_ 5.x.x ?

@PradoGuilherme the OP reported any 4 versions working fine. It only started happening with version 5+

IAP updates support new Android / iOS versions. This problem occurs only on Android only and the relevant change I see for react-native-iap for version 5.0.0 is Fixes on missing [userId] and [profileId] on android #1141 and Support Amazon IAP feature#1134 these two packages (i.e. one signal and IAP) collide at one point. The issue is filed here is because of where the crash occurs. My thought is, if this is a relatively easy fix for the one-signal package, it would be great the team can look into it.

Facing same issue

"react-native-iap": "5.1.1",
"react-native": "^0.63.2",
"react-native-onesignal": "^4.0.4",

I downgraded iap package to "4.6.3" . It worked !!

Howdy! That's great news @hrishiakhade

Others, please open an issue with react-native-iap regarding the issue.

Cheers!

Was this page helpful?
0 / 5 - 0 ratings