evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

Works everywhere but iOS10.3 #903

Open phzbox opened 6 years ago

phzbox commented 6 years ago

Hi,

I've got push notifications working on iOS11 and all android, but for some reason it's not working on iOS10.3.

Everything is configured using FCM, react-native-fcm and a .p8 certificate.

On iOS10.3, I'm simply not getting APNs notifications. It asks for the permission, I see the FCM token, but the APN part is just not triggered, neither on the foreground or background.

However, on iOS11, everything works as expected.. I can send a push notif. from the server or using the FCM UI.

Is iOS11 using a different method for APN messages which could explain this issue?

Thanks

phzbox commented 6 years ago

Just adding more info:

FCM.getAPNSToken() returns an empty string. I tried to debug in the RNFIRMessaging.m and in getAPNSToken, [deviceToken length] is of length 0. I'm not sure where it's supposed to be set but it seems like it's not happening, and I don't get any errors.

For the code, I'm using:

async function testPush() {
  FCM.on(FCMEvent.RefreshToken, token => {
    console.log("TOKEN (refreshUnsubscribe)", token);
  });

  const r1 = await FCM.getInitialNotification()
  console.log('initialNotif:', r1)

  const r = await FCM.requestPermissions({
    badge: false,
    sound: true,
    alert: true
  });
  console.log('permission:', r)

  const fcmToken = await FCM.getFCMToken();
  console.log('fcm', fcmToken)

  if(Platform.OS === 'ios'){
    const apnsToken = await FCM.getAPNSToken()
    console.log('apns', apnsToken)
  }
}
skaan commented 6 years ago

I have the same problem. I get the FCM Token and sent the push there that works, but no APNS Token on device.

evollu commented 6 years ago

does FCM.getAPNSToken() return you value on iOS 11?

phzbox commented 6 years ago

yes On Thu, Apr 19, 2018 at 12:47 PM Libin Lu notifications@github.com wrote:

does FCM.getAPNSToken() return you value on iOS 11?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evollu/react-native-fcm/issues/903#issuecomment-382804387, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvjXLbEmkZaUeTUrD-RYEfAVWvmlL21ks5tqL-LgaJpZM4TYSS_ .

evollu commented 6 years ago

there isn't breaking api change from 10 to 11 that I'm aware of. try reinstall the app?

phzbox commented 6 years ago

Just a quick update on this.. I tried to make it work using the native PushNotificationIOS and I wasn't getting the APNS token, so I'm still trying to figure it out.

On Thu, Apr 19, 2018 at 1:03 PM, Libin Lu notifications@github.com wrote:

there isn't breaking api change from 10 to 11 that I'm aware of. try reinstall the app?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/evollu/react-native-fcm/issues/903#issuecomment-382809431, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvjXGT2eJqGi0-ElfRhGrli1P7cVPsDks5tqMNMgaJpZM4TYSS_ .

temitope commented 6 years ago

anyone crack this. getting inconsisten/weird behavior of some phones receving push and others not. trying to troubleshoot. thx. tried a full app uninstall and reinstall from store. no avail.