OneSignal / react-native-onesignal

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

getDeviceState method does not return UserId #1204

Closed codeoholic closed 3 years ago

codeoholic commented 3 years ago

Description:

It's been a few days now that I am stuck on this. getDeviceState method does not return UserId on my iPhone 11 running iOS 14.3. When I use the same code base to test on iPhone 6 running an older iOS version userId is returned correctly. Same is the case with iPad. This can also be verified on OneSignal dashboard with no device registration from iPhone 11.

Environment

  1. react-native-onesignal v4.0.6
  2. npm
  3. react-native v0.64.0
rgomezp commented 3 years ago

Howdy, Can you check that you are subscribed? Try sending a test push notification or checking that the device appears in the "All Users" tab of the OneSignal dashboard.

Also note that the iOS Simulator cannot be used with push notifications.

codeoholic commented 3 years ago

Hello Rodrigo, The dashboard is having no iPhone 11 related userId/player id while I can see the other devices. About the simulator, yes I am using a physical device.

rgomezp commented 3 years ago

Howdy, That means that your device is not even subscribed and the issue is not with the function.

Please check our Troubleshooting guides and make sure that you have your iOS steps including certs setup correctly.

codeoholic commented 3 years ago

I am not sure how is this happening because the same codebase is working for other devices. If the setup would have been incorrect, nothing should have worked, but it's just the iPhone 11 which is not working here.

rgomezp commented 3 years ago

Howdy, That's strange. It probably has something to do with the device but not because it's iPhone 11. Did you try uninstalling the app completely and re-installing it?

codeoholic commented 3 years ago

Hello Rodrigo, There's an update here. I noticed two things while fixing this issue.

  1. The .entitlements file has APS Environment set to development as default while it should be production. I took this hint from the OneSignal's iOS documentation.
  2. My device is almost all the time on VPN, turns out OneSignal reject requests coming from VPN providers. This explains why my other devices got registered but not my iPhone 11. I think cloudflare is to be blamed here for never delivering the request to your endpoints. Can you help me get in touch with some someone from the concerned department?

Closing this issue, as it is no longer related to this library.