tsepen
@tsepen
Frontend developer

Как отобразить пуш при открытом приложении на IOS?

"dependencies": {
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-native-firebase/app": "^14.11.0",
    "@react-native-firebase/messaging": "^14.11.0",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-device-info": "^10.3.0",
    "react-native-push-notification": "^8.1.1",
    "react-native-safe-area-context": "^4.5.0",
    "react-native-version-number": "^0.3.6",
    "react-native-webview": "^11.26.0"
  }


Использую react-native-push-notification
в PushNotification.configure - не срабатывает событие onNotification на ИОС когда приложение отображается на экране (foreground), на андроиде работает корректно

В AppDelegate.mm добавил по мануалу
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
  completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}


Пробовал через @react-native-firebase/messaging, та же ситуация, вероятно ошибка где то в нативной части
  • Вопрос задан
  • 62 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы