ios - 从 Django 后端推送通知到 iOS/Swift 前端
问题描述
我处于一个毛茸茸的情况,不知道如何进行。
- 我们需要为这个项目实现 django 推送通知。
- 我研究过最好用的图书馆。django-push-notifications ( https://github.com/jazzband/django-push-notifications ) 看起来是最新的库。APNS 部分基于 apns2 ( https://github.com/Pr0Ger/PyAPNs2 )
- 我确实必须对 BE 测试进行一些修改。我基本上设置了项目以正确地完成所有事情,然后“假装”向苹果发送推送通知。在这个阶段,django 和苹果之间没有发生握手。
- 在测试期间,使用自签名证书只是为了让 apns2 满意。因为 heroku 不允许文件上传,所以我不得不做一些棘手的事情来将证书加载到 django 中的文件中(基本上是从环境变量中读取并将其写入文件)。
- 直到最近我才发现 FE 开发人员只给了我一个私钥,而不是证书。django_push_notifications 需要证书。他进一步告诉我,苹果在 2019 年停止了证书,只使用私钥。
- django_push_notifications 对此没有任何问题。[但是,我确实在文档中注意到了这个页面:https://github.com/jazzband/django-push-notifications/blob/master/docs/APNS.rst]
Generation of an APNS PEM file
------------------------------
The ``APNS_CERTIFICATE`` setting must reference the location of a PEM file. This file must contain a certificate and private key pair allowing a secure connection to Apple's push gateway.
任何人都可以建议吗?我错过了什么?
解决方案
推荐阅读
- javascript - TypeScript,没有带有“字符串”类型参数的索引签名
- java - 使用 org.lwjgl.stb 加载纹理
- r - 重组数据框(pivot_wider)
- android - 我在android中的编辑文本无法从编辑文本中获取文本
- sql-server - 从具有相同日期和时间的 2 个不同数据表中查找变量的平均值
- django - 如何使用 Django 网页获取 windows 用户名
- javascript - 通过 c# 监听 websocket 事件(用 Javascript 编写)
- javascript - 将json的字段转换为javascript中的数组的最快方法是什么?
- reactjs - 为什么我的应用程序返回“操作必须是普通对象,使用自定义中间件进行异步操作”
- python - 表单的 CharField 未显示在 Django 项目中