【问题标题】:I receive MissingProviderToken error with APNs我收到 APNs 的 MissingProviderToken 错误
【发布时间】:2022-12-22 06:05:35
【问题描述】:

我在 Golang 中通过 APNs 在 iOS 上发送带有证书的推送通知,但我收到 MissingProviderToken 错误。事实上,调试代码时,我看到客户端有一个空令牌。我使用 sideshow 库, sideshow/apns2。

cert, err := certificate.FromP12File("./certificates.p12", "*filepassword*")

if err != nil {
   log.Fatal("Cert Error:", err)
}
notification := &apns2.Notification{}
notification.DeviceToken = *deviceToken*
notification.Topic = "*appbundleid*"
notification.Payload = []byte(`{
      "aps" : {
         "alert" : "Hello!"
      }
   }
`)

client := apns2.NewClient(cert).Production()
res, err := client.Push(notification)

这个token需要证书传递吗?

我尝试了我公司创建的两个不同的证书,但仍然返回 403 MissingProviderToken。 我也试过了 client := apns2.NewClient(cert).Development() 我可以手动传递令牌只是为了尝试吗? 有没有人经历过这个或者我在哪里犯了错误?

【问题讨论】:

  • 我遇到了同样的问题,你解决了吗?
  • 我有错误的证书。更改证书就可以了。

标签: ios go push-notification apple-push-notifications


【解决方案1】:

来自本指南Local and Remote Notification Programming Guide: Communicating with APNs,这意味着 No provider certificate was used to connect to APNs and Authorization header was missing or no provider token was specified。

所以,更改证书。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-30
    • 2018-12-21
    • 2015-09-13
    • 2017-01-05
    • 2017-08-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多