OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 374 forks source link

Debugging iOS Push Notifications in Production Advice #1108

Closed markhalonen closed 3 years ago

markhalonen commented 3 years ago

Description: I am just looking for advice on how to debug my production app, where only the FIRST notification works, and then no further push notifications come through. When I install locally on XCode, everything works beautifully. Yes, it's bizarre.

Is it possible to get the text of the OneSignal logs programmatically and save it to AsyncStorage so I can debug in production?? I can get the callback of setExternalUserId but the logs look much more informative.

It may be something with my phone. I am not getting Push Notifications from SnapChat either.

Environment

  1. What version of the OneSignal React-Native SDK are you using? 3.9.2
  2. How did you add the SDK to your project (eg. npm) I did it a year ago, honestly don't remember.

Steps to Reproduce Issue: I don't think it can be reproduced. Tomorrow I'll try on a coworkers iOS device. I am more just looking for advice on how to debug in production.

markhalonen commented 3 years ago

Perhaps it's https://piunikaweb.com/2020/12/05/iphone-users-on-ios-14-reporting-no-notifications-issue-fixes-found/ ?? I know the iPhone user community is massive, so maybe this is just noise

markhalonen commented 3 years ago

I should add that I recently updated from RN 0.61.2 to RN 0.63.4 and also I'm on iOS 14.2

I also updated OneSignal from 3.6.3 to 3.9.2

Another question, I see the beta got released, should I invest in upgrading to the beta?

I should also note that it has been successfully working for several months. Sometimes there are hiccups and users have to delete/reinstall to get notis working, but by and large a lot of notifications have successfully worked...

markhalonen commented 3 years ago

Ok, I just reproduced on my friends phone, it again worked for the first notification, then doesn't work for my app after that, and also breaks the notifications for SnapChat and probably GroupMe. 😬 😬

It does not break notifications for all apps, for example Keybase notifications are still working.

I think tomorrow I'll try upgrading to the new beta, it can't get much worse than what I currently have

markhalonen commented 3 years ago

Another interesting behavior is that when I delete my app (that uses OneSignal RN (https://waldologs.com/)), I actually get notis from my app along with a bunch of notis from other apps like GroupMe. So it's like it's blocking notifications and then when I delete it they all get released.

markhalonen commented 3 years ago

Ok I upgraded to the beta and things are looking good. It also appears my other apps SnapChat and GroupMe are receiving notifications.

I will deploy a new version to App Store and see how it goes!

markhalonen commented 3 years ago

I cannot figure this out. Tried https://github.com/OneSignal/OneSignal-iOS-SDK/issues/684 that didn't change it any.

First 0-10 notifications work, then it's toast. No notifications come through. When I delete the app, I get the notifications that I missed AFTER deleting the app (!!).

Everything looks good in the OneSignal web app.

I call setAppId and setExternalUserId on every load of my root component App in react native. Is it possible to break it by calling these methods multiple times?

I sent a notification directly to player_id instead of using external_user_id, no dice.

So the issue appears to be local on the device

markhalonen commented 3 years ago

I printed out result of OneSignal.getDeviceState(), nothing looks out of sorts:

image

markhalonen commented 3 years ago

Ok, I think I found a fix. I downgraded to what worked previously 3.6.3 and things seem to work. In conclusion, I upgraded to 3.9.2 and that failed, so I tried 4.0.0-beta.4 and that didn't work either. So I downgraded to 3.6.3 and that worked.

Perhaps I upgraded wrongly, perhaps I ran into the same issue as https://github.com/OneSignal/react-native-onesignal/issues/1109 (but somehow only in production).

"The American dream is to make a sh*tload of money using software and then never use a computer again"