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

查看:174
本文介绍了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?

推荐答案

我重新下载推送生产证书并从钥匙串中导出as .p​​12。这似乎解决了这个问题。虽然一个糟糕的私钥给我无效令牌错误,但这似乎很奇怪。

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天全站免登陆