zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.74k stars 2.05k forks source link

I don't receive device token on iOS #1204

Closed IonutRealDevs closed 4 years ago

IonutRealDevs commented 4 years ago

Hello. I have a problem on iOS, i don't receive device token and i don't know what i am doing wrong. On Android all is working but on iOS don't. When i open the app on iOS device i get that prompt message if i want to allow to receive notifications.

I followed the tutorial from here, but i used react-native link instead manual linking. What am i missing?

mrminhhuy commented 4 years ago

Hi @IonutRealDevs Are you run in iOS with simulator or real device?

IonutRealDevs commented 4 years ago

Real device connected to mac, i know that on simulator is not working.

mrminhhuy commented 4 years ago

@IonutRealDevs Hello, you can give your code in here, Notification implement only.

IonutRealDevs commented 4 years ago
import PushNotification from 'react-native-push-notification'

export default PushNotifications = () => {
  PushNotification.configure({
    onRegister: function(token) {
      console.log('Token', token)
    },
    senderID: '474326164077'
  })
}

Here is it. Also i added in AppDelegate.m the code from documentation.

ameenmattar commented 4 years ago

Same problem here, I am not sure if this a linking issue or not. "react-native": "0.60.0", "react-native-push-notification": "^3.1.9",

same code as @IonutRealDevs and the onRegister is not being called and no token generated

AppDelegate.m is : Screen Shot 2019-10-02 at 5 44 32 PM

ameenmattar commented 4 years ago

What solved my issue was to enable the push notification in the capabilities, I forgot to do this at first

IonutRealDevs commented 4 years ago

Me too, i solved by enabling notifications in capabilities, but now i don't receive notifications . In AWS SNS the status for the token is Enabled first time, after i try to send a message, the status became Disabled... How to solve this?