我已经搜索了Stackoverflow,但没有一个回答我的问题,即从Xcode APNS进行构建有效,但是后端提出了App Store版本BadDeviceToken
。
该Success
是registration_id
由从源代码制作
In [1]: APNSDevice.objects.all().send_message("test")
Out[1]:
[{'27321a3d872613499e27638733e9d1da7e6aa52888a2d90769b150f6339360b1': 'Success',
'798a23a46169e405c41a0c9f44faa0acd39a65119960b973acd248a6de1d624e': 'Success',
'1d742a9ae1684fed5e6c672587ee27c1523cc97e931cc64f108f7c4924aba2af': 'DeviceTokenNotForTopic',
'27173de1aed3a065644708602fd5659cf4e0f8c3ce5b3ef7c4b0769655b92041': 'DeviceTokenNotForTopic',
'e5647247877a0e1db3c7b52821b4230551267ca8a360f862ec5dde506e9b2f36': 'Success',
'0eecae0cb6f4c27ee4b915e37dbb9c7cc84e4967e71c8efab808e231f46b8ec6': 'BadDeviceToken',
'582d6a7c4628131cba9d0dfa9096cc81e3b48f6b6409252515d7402ef1c3ef30': 'BadDeviceToken'}]
我现在不在乎DeviceTokenNotForTopic
。只是专注于BadDeviceToken
复制步骤如下:
.p12
文件.pem
从doc制作。我必须把passphrase
以key
otherwise I can not proceed next stepregistration_id
检查:
pushtry.com
我上传.p12
并放入registration_id
。我可以得到它的作品push notification
openssl s_client -connect gateway.push.apple.com:2195 -cert aps-cert.pem -key aps-key-noenc.pem
也可以没有任何问题。连接仍然存在
My configuration:
Django3
django-push-notification @master commit: c610dd9c7871f4e81bdffce783df8b040ca22878
settings.py
PUSH_NOTIFICATIONS_SETTINGS['APNS_CERTIFICATE'] = str(APPS_DIR) + '/push_noti/dd/aps.pem'
PUSH_NOTIFICATIONS_SETTINGS['APNS_USE_SANDBOX'] = "gateway.push.apple.com:2195"
PUSH_NOTIFICATIONS_SETTINGS['APNS_TOPIC'] = "com.multy.herr.reviews"
I had tried with the same production
APNS cert according to this
Development server: api.sandbox.push.apple.com:443
Production server: api.push.apple.com:443
However, all giving me same BadDevieToken
FYI:
I am using production
APNS cert
I take care only Django backend. My iOS developer upload app from his computer. I am not sure this will be problematic or not
I had tried fastlane
with pushtry.com
again .p12
works, but .pem
does not. It pop up dialog production_com.xxx.yyy.zzz.pem | 3883 | application/x-x509-ca-cert
Question:
Where am I wrong?
Another Solution:
I might use AWS SNS to deal with this
@Wyetro is correct. The problem comes from that line I was confused with document and codebase at certain level in the lib itself it use bool
PUSH_NOTIFICATIONS_SETTINGS['APNS_USE_SANDBOX'] = False
Then I can be able to send out message
Glad you got it figured out