【问题标题】:Sending APNs notification returns Success but no notification appears on phone发送 APNs 通知返回成功,但手机上没有通知
【发布时间】:2021-08-07 20:57:33
【问题描述】:

我正在尝试使用 pushjack 库在 iphone 上发送推送通知 (https://github.com/joseph-fox/pushjack)。

我正在尝试使用我公司的测试电话令牌和 pem 文件运行提供的示例。

我要运行的代码是这样的:

 
    from pushjack_http2 import APNSClient

    client = APNSClient(certificate='<mypem>.pem',
                        default_error_timeout=10,
                        default_expiration_offset=2592000,
                        default_batch_size=100,
                        default_retries=5)

    token = '<mytoken>'
    alert = 'Hello world.'

    res = client.send([token], alert)

    resp = {'successes': res.successes, 'failures': res.failures, 'tokens_sent': res.tokens, 'errors': res.errors,
            'token_errors': res.token_errors}
    return resp

我得到的响应如下:

{'successes': ['<mytoken>'], 'failures': [], 'tokens_sent': ['<mytoken>'], 'errors': [], 'token_errors': {}}

当通过 pushtry (https://pushtry.com/) 使用相同的 .pem 和令牌时,我的通知会正确显示在手机上(我想知道它是否与我在那里提供的捆绑 ID 有关,但没有示例代码中提供的选项)。

这是一个相当模糊的问题,但是,有人知道为什么会发生这种情况吗? 我已经尝试了开发和生产 .pem 文件,并且都返回成功,而没有一个通知正确弹出。您对可能出现的问题或我如何四处探查以找出问题有任何想法吗?

谢谢!

【问题讨论】:

    标签: python apple-push-notifications python-3.7 http2


    【解决方案1】:

    事实证明,我没有意识到苹果在 3 月 31 日更改了他们的后端的某些内容,并且我尝试使用的库已被弃用。

    改用apns2解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-21
      • 2012-02-22
      • 1970-01-01
      • 1970-01-01
      • 2015-12-29
      • 1970-01-01
      • 2018-04-17
      • 1970-01-01
      相关资源
      最近更新 更多