沙盒和PushNotification的生产之间的区别 [英] Difference between sandbox and production for PushNotification

查看:49
本文介绍了沙盒和PushNotification的生产之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,它们在沙盒环境中起作用:

I have the following code, which functions in a sandbox environment:

def send_push_notification(user, message):
    ns = apns.APNs(
        use_sandbox=True,
        cert_file="certs/CCert.pem",
        key_file="certs/CKey.pem",
    )
    token_hex = user.push_notification_token
    payload = apns.Payload(alert=message, sound="default")
    return ns.gateway_server.send_notification(token_hex, payload)

如果我设置 use_sandbox = False ,会有什么区别?两种环境有什么区别?

What would be the difference if I were to set use_sandbox=False? What are the differences in the two environments?

推荐答案

APNS有两种环境,即开发(沙盒)和生产环境.对于每种环境,您需要不同的证书并将有效负载发送到相应的网关.对于一台iOS设备,还有一个用于开发的令牌和一个用于生产的令牌.

There are two environments for APNS, namely development (sandbox) and production. For each environment, you need different certificates and send the payload to the corresponding gateway. and also for one iOS device, there are one token for development and one for production.

有关详细信息,您可以参考 PyAPN ,如有必要,您可以引用它.

For detailed information, you can refer to here and also this tutorial is much helpful, since you are using PyAPNs, you can refer it if necessary.

这篇关于沙盒和PushNotification的生产之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆