ios 消息传递/未知..操作无法完成,(com.google.iid错误-34018,)]

6bc51xsx  于 2022-12-20  发布在  iOS
关注(0)|答案(1)|浏览(658)

我正在Xcode测试专为Mac设计的iPhone上的推送通知,我尝试在iPhone模拟器上运行应用程序,我可以成功获得令牌。在Android上,它也工作得很好。但当我在(专为Mac设计的iPhone)上运行时,我得到这个错误
[messaging/unknown]操作无法完成。(com.google.iid错误-34018。)]
我使用的是'@react-native-firebase/messaging'
我搜索了一下,问题似乎与钥匙链访问有关,下面是我在GitHub问题上找到的旧答案

You need to clean your keychain cache since you made some critical changes on certificates.
Go to Keychain Access -> login -> Passwords
and make sure you removed all below items.

[your firebase project number.*]
[your app bundle ID]
com.google.iid.checkin

我试过这个,但问题仍然存在。
下面是我的代码来获得令牌。

const getToken = async () => {
    try {
      const token = await messaging().getToken();

      console.log('============= messaging token =============');
      console.log({token});

      await saveItem(AsyncKeys.DEVICE_TOKEN, {device_token: token});
    } catch (error) {
      console.log('======== error post token ==========');
      console.log(error);
    }
  };
fnx2tebb

fnx2tebb1#

您需要清理您的钥匙串缓存,因为您对证书做了一些重要更改。
转到钥匙串访问-〉登录-〉密码
并确保已删除以下所有项目。

  • [您的firebase项目编号。*]
  • [您的应用程序捆绑包ID]
  • com.google.iid.checkin

相关问题