设备Tocken将在安装后从diawi或TestFlight更改?所以推送通知不会到来 [英] Device Tocken will Change after install from diawi or TestFlight? So Push notification is not coming

查看:493
本文介绍了设备Tocken将在安装后从diawi或TestFlight更改?所以推送通知不会到来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个需要从服务器接收推送通知的应用。

I'm currently creating an app that needs to receive push notifications from a server.

当我拿到设备令牌时,我将其发送到我的服务器并保存它进入DB,

When I got the device token, I send it to my server and save it into DB,

我的问题是:

何时我试图在XCode上正常安装应用程序,我得到了正确的设备令牌,它正在用于推送通知。

When I tried to normally install application on device from XCode, I got the correct device token and it is working for push notification.

但是当我尝试从TestFlight安装应用程序或diawi,设备tocken已更改,并且错误的设备tocken应用程序未收到任何推送通知。

But when I tried to install application from TestFlight or diawi, device tocken changed and for that wrong device tocken application not receive any push notification.

任何帮助将不胜感激

推荐答案

我找到了我的问题的答案。

I found answered of my question.

永远不要将您的NSUserDefaults'密钥用作@密钥。

例如我之前使用过的。

[[NSUserDefaults standardUserDefaults] setObject:deviceToken forKey:@"key"];
[[NSUserDefaults standardUserDefaults] synchronize];

我现在使用的是什么。

[[NSUserDefaults standardUserDefaults] setObject:deviceToken forKey:@"token"];
[[NSUserDefaults standardUserDefaults] synchronize];

现在推送通知即将到来。

And now push notification is coming as it is.

所以结论从未使用过您的密钥名称 @key。我不知道为什么,但可能有些偏好是默认使用 @key

So conclusion is never used your key name @"key". I don't know why but may be some preference is using this @"key" by default.

谢谢。

这篇关于设备Tocken将在安装后从diawi或TestFlight更改?所以推送通知不会到来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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