Iphone - 多个应用程序,不同的应用程序ID,相同的令牌 [英] Iphone - Multiple Apps, Different App ID, Same Token

查看:112
本文介绍了Iphone - 多个应用程序,不同的应用程序ID,相同的令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的理解,如果设备上安装了多个具有不同应用ID的应用,则为每个应用生成的推送通知令牌应该是唯一的。

From what I understand, if there are multiple apps with different App ID installed on a device, the tokens for push notification generated for each apps should be unique one to another.

就我而言,我有几个使用不同配置文件编译的应用程序,每个应用程序都基于不同的应用程序ID(尽管其中一些具有相同的Bundle Seed ID,有些则没有)。

In my case, I have several apps compiled with different provisioning profiles and each of them is based on different App IDs (though some of them has same Bundle Seed ID, some don't).

对于每个应用程序,我生成了开发推送通知SSL并导出SSL以生成PEM。接下来,我下载配置文件并将其应用于XCode。

For each app I generated development push notification SSL and export the SSL to generate PEM. Next I download the provisioning profile and applied it to XCode.

当我尝试在我的设备上运行它时,我得到的是:

When I tried to run it on my device, what I get from :

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

所有应用程序都是一个相同的设备令牌。我想知道为什么会这样?

on ALL apps are a single same device Token. I wonder why is that?

当我试图通过我的服务器推送通知时,没有收到任何错误消息。但是通知从未发送到已安装的设备。

And when I tried to push a notification via my server, there was no error message received. But the notification never delivered to installed devices.

请给我这个问题的建议。在此先感谢。

Please give me suggestions on the problem. Thanks in advance.

推荐答案

设备令牌对于每个应用程序都不是唯一的,无论它是生产环境还是开发环境。您可能想知道,如果所有应用程序的设备令牌相同,那么推送通知如何路由到正确的设备和正确的应用程序?答案是应用程序的唯一捆绑ID。 App Store上的每个应用程序都有一个唯一的标识符,例如:com.mycompanyname.dummyapp。当应用程序注册自己的推送通知时,应用程序包ID和设备令牌都在Apple的服务器上注册。

The device token is not unique for each application, no matter if it is the production or development environment. You might be wondering, if the device token is the same for all apps then how is it possible that push notifications are routed to the right devices and the right applications? The answer is the app's unique bundle id. Each and every application on the App Store has a unique identifier, e.g.: com.mycompanyname.dummyapp. When an application registers itself for push notifications both the app bundle id and the device token are registered on Apple's servers.

Willy,您可能要检查的最后一件事,配置推送通知的第一步是从Keychain管理器创建CertificateSigningRequest.certSigningRequest文件。如果您有2个应用程序,则必须执行此步骤两次,以便最终得到2个不同的文件,这些文件将在Apple的门户中用于创建SSL.cer文件。您的问题可能是您使用相同的.certSigningRequest来创建不同的SSL.cer文件而不是使用不同的文件。

Willy, one last thing that you might want to check, the very first step when configuring Push notifications is the creation of a CertificateSigningRequest.certSigningRequest file from the Keychain manager. If you have 2 apps you have to do this step twice so you end up with 2 different files that will be used in Apple's portal to create the SSL.cer file. Your problem might be that you used the same .certSigningRequest to create the different SSL.cer files instead of using a different one.

这篇关于Iphone - 多个应用程序,不同的应用程序ID,相同的令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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