首页 > 解决方案 > React Native Push Notifications 未出现在设置中

问题描述

我是本机反应的新手,我正在尝试通过 iOS 设置推送通知。

我已经安装了 pushNotificationios 并按照给出的说明进行操作。我还注册了 Apple Developer。

当我运行我的应用程序时,推送通知似乎不起作用。当我进入我的 iPhone 设置并单击应用程序时,它不会显示通知。

设置

这是我的代码

import PushNotificationIOS from '@react-native-community/push-notification-ios';
import PushNotification from "react-native-push-notification";

const configure = () => {
 PushNotification.configure({

   onRegister: (token) => {
    console.log('TOKEN:', token);
     //process token
   },

   onNotification: (notification) => {
     // process the notification
     console.log("NOTIFICATION:", notification);
     // required on iOS only
     notification.finish(PushNotificationIOS.FetchResult.NoData);
   },

   permissions: {
     alert: true,
     badge: true,
     sound: true
   },
  
   popInitialNotification: true,
   requestPermissions: true,

 });
};


 export {
    configure,
   };

标签: iosreact-nativepush-notification

解决方案


我不知道你的包名是否有一些特殊字符,但我和你有同样的问题,为了解决我需要去 xCode,构建设置(项目)并更改产品名称,因为我的产品名字有口音(如“ó”),而那不是英文名字。可笑但已解决


推荐阅读