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

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

问题描述

据我了解,如果在一台设备上安装了多个具有不同 App 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.

威利,您可能要检查的最后一件事,配置推送通知的第一步是从钥匙串管理器创建 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天全站免登陆