-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native push notifications not working in iOS. #443
Comments
Did you figure it out? |
Hi @Saad-Bashar, |
I was able to hack this by giving some time to report the notification arrived, I added something like this in my AppDelegate: dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
}); |
Any updates on this? |
I would 2nd that you probably want to have some delay here. Here's mine. (We happen to use Adobe's marketing cloud, so the notification response (pressed/dismissed) is tracked for marketing analytics purposes too.) tl;dr, wrap in
Please excuse the ugly formatting. I use |
I am trying to set up the push notification for iOS for React Native version 0.71.7. I have done all the setup for this push notification which is mentioned in your git repository. Push notification was working fine for my old version of project 0.67.2. But in this new version, it is not working. Please help me out to solve this problem.
Mechine Configaration :-
Mac Os Version:- 14.4.1
Xcode Version:- 15.3
Node Version:- v20.12.0
RN Version:- 0.71.7
Sample code base which i am using in the index.js
import { SafeAreaView, Text, View } from 'react-native';
import React, { Component } from 'react';
import PushNotificationIOS from "@react-native-community/push-notification-ios";
import PushNotification from "react-native-push-notification";
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
deviceToken: ""
};
}
componentDidMount() {
this._getToken();
const type = 'notification';
PushNotificationIOS.addEventListener(type, this.onRemoteNotification);
return () => {
PushNotificationIOS.removeEventListener(type);
};
}
onRemoteNotification = (notification) => {
const isClicked = notification.getData().userInteraction === 1;
if (isClicked) {
// Navigate user to another screen
} else {
// Do something else with push notification
}
// Use the appropriate result based on what you needed to do for this notification
const result = PushNotificationIOS.FetchResult.NoData;
notification.finish(result);
};
// get RCM token for push notification
_getToken = () => {
let that = this;
};
render() {
return (
<SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 20 }}>App
)
}
}
I am sharing the reference screenshots.





Please help me to solve this problem i have been suffering from this problem for a long time after upgrading the React native project version.
The text was updated successfully, but these errors were encountered: