iOS:生产推送通知,来自 APNS 服务器的无效令牌 [英] iOS: Production push notifications, Invalid token from APNS server

查看:29
本文介绍了iOS:生产推送通知,来自 APNS 服务器的无效令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序现已在应用程序商店中提供,因此我已将其下载到我的设备上.推送通知在开发过程中运行良好.我正在使用 JavaPNS 发送通知,并且我已将其切换为指向 Apple 的生产服务器.

My app is now available in the app store, so I've downloaded it to my device. The push notifications were working fine during development. I am using JavaPNS to send out the notifications, and I have switch it to point to Apple's production servers.

但是,我现在从 APNS 服务器收到无效令牌错误.

However, I'm now getting an Invalid Token error back from the APNS servers.

我将存档方案设置为发布",并将发布设置为使用此分发配置文件:

I have the Archive scheme set to "Release", and I have Release set to use this distribution profile:

在该配置文件中,您可以看到我的环境设置正确:

Inside that provisioning file, you can see that I have the environment set correctly:

但我仍然收到错误消息.当我查看我的数据库时,我认为应用程序返回给我的设备令牌与开发的相同,所以这可能是问题所在.但我不知道为什么它会返回,因为该应用程序已正确签名.这是我也用于测试的设备,这会不会有问题?关于这里发生的事情还有其他想法吗?

Yet I still get the error. When I look in my database, I think the device token the app is returning to me is the same as the development one, so that could be the problem. But I don't know why it would be returning that, given that the app is signed correctly. This is a device I also used for testing, could that be a problem? Any other ideas about what's happening here?

谢谢!

我没有在我的代码中存储令牌,Eran 的回答表明唯一的其他可能性是我的数据库中的旧令牌,或者应用程序没有由生产配置文件签名.我清除了我的数据库,所以我知道它不是前者,至于后者,我不明白这是怎么回事,因为我只有一个分布配置文件,正如我上面所示,它正确设置了aps-environment"键.XCode 甚至不会让我使用应用商店提交的开发配置文件,是吗?其他一些可能性:

I'm not storing a token in my code, Eran's answer suggests that the only other possibilities are an old token in my database, or the app not being signed by a production profile. I'm cleared my database, so I know it's not the former, and as for the latter, I don't see how that could be the case, since I only have one distribution profile, and as I've shown above, it has the "aps-environment" key set correctly. XCode wouldn't even let me use a development profile for app store submission, would it? A few other possibilities:

我随通知发送的密钥有问题可能会导致无效令牌"吗?如果是这样,我可以为我现有的配置文件重新生成此密钥吗?

Is it possible that something being wrong with key I'm sending with my notifications could cause "Invalid Token"? If so, can I regenerate this key for my existing profiles?

AppID 中不是包含另一个用于推送通知的配置文件吗?是否有问题会导致无效令牌错误?

Isn't there another provisioning profile contained in the AppID for the purposes of push notifications? Could a problem with that cause the invalid token error?

推荐答案

我重新下载了推送生产证书并将其从钥匙串导出为 .p12.这似乎解决了问题.尽管错误的私钥给了我无效令牌"错误,但这似乎很奇怪.

I re-downloaded the push production certificate and exported it from the keychain as .p12. This seems to have solved the problem. It seems strange though that a bad private key was giving me the "Invalid Token" error.

这篇关于iOS:生产推送通知,来自 APNS 服务器的无效令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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