OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 373 forks source link

Doesn't work with In App Purchases #1093

Closed sadooghi closed 3 years ago

sadooghi commented 3 years ago

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"
rgomezp commented 3 years ago

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

Cheers

sadooghi commented 3 years ago

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)

felipegmg commented 3 years ago

Hi! I have exactly the same issue!

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

Any solution?

sadooghi commented 3 years ago

Hi

Any updates on this?

rgomezp commented 3 years ago

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

mozadeh commented 3 years ago

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

PradoGuilherme commented 3 years ago

hey, same issue here. Any updates?

PradoGuilherme commented 3 years ago

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

mozadeh commented 3 years ago

Any updates on this? this is a big blocker.

rgomezp commented 3 years ago

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

PradoGuilherme commented 3 years ago

hey @rgomezp,

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

rgomezp commented 3 years ago

You need to downgrade the other package.

PradoGuilherme commented 3 years ago

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

mozadeh commented 3 years ago

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.

rgomezp commented 3 years ago

@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+

mozadeh commented 3 years ago

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.

hrishiakhade commented 3 years ago

Facing same issue

"react-native-iap": "5.1.1",
"react-native": "^0.63.2",
"react-native-onesignal": "^4.0.4",
hrishiakhade commented 3 years ago

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

rgomezp commented 3 years ago

Howdy! That's great news @hrishiakhade

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

Cheers!