如何在 React Native 上的 iPhone 设置上手动禁用后检测 PushNotificationIOS 状态



在手机设置上手动禁用推送通知后,代码未触发

PushNotificationIOS.addEventListener('register', (deviceToken) => {
    console.log('PushNotificationIOS.register,-------', deviceToken);
        });
PushNotificationIOS.addEventListener('registrationError', (response) => {
            console.log('PushNotificationIOS.registrationError,=====', response);
        });

所以我无法检测到远程通知是否已禁用。

你可以使用 PushNotificationIOS 的 checkpermissions,它返回一个这样的对象:

{"alert":1,"badge":1,"sound":1}

最新更新