ios - 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,
};
解决方案
我不知道你的包名是否有一些特殊字符,但我和你有同样的问题,为了解决我需要去 xCode,构建设置(项目)并更改产品名称,因为我的产品名字有口音(如“ó”),而那不是英文名字。可笑但已解决
推荐阅读
- blazor-webassembly - 使用 Blazor 作为组件
- macos - 通过互联网在 OSX 平台上进行远程管理(动态 ip)
- python - 如何在txt中写入参数名称和值列表?
- azure - 获取 azure 存储表字段类型
- reactjs - react.js 中出现错误,TypeError: Cannot read property 'map' of undefined
- python - 内部函数内部的 UnboundLocalError
- jenkins - 如果詹金斯构建失败,我如何阻止用户在 Bitbucket 上合并拉取请求
- ios - 无法设置一个 AWS SNS 来同时服务于开发 (APNS_SANDBOX) 和生产 (APNS)
- javascript - 重定向到页面上的按钮点击反应
- c# - CodeDom 不使用 MemberAttributes