I'm actually on a chat application using react-native and I have a database on firebase. I have the notifications on android whenever an user post a new message but on iOS it doesn't work. In my code, I subscribe the user into a topic when he send a message.
export const sendMessage = message => {
return (dispatch) => {
dispatch(chatMessageLoading())
let currentUser = firebaseService.auth().currentUser
let createdAt = new Date().getTime()
let chatMessageCars = {
text: message,
createdAt: createdAt,
user: {
id: currentUser.uid,
email: currentUser.email,
}
}
FIREBASE_REF_CARS.push().set(chatMessageCars, (error) => {
if (error) {
dispatch(chatMessageError(error.message))
} else {
dispatch(chatMessageSuccess())
FCM.requestPermissions();
firebase.messaging().subscribeToTopic('Nextdoor')
}
})
}
}
I have the apple developer program and I have enabled push notifications and remote notifications.
Thanks !