Iphone - 多个应用程序、不同的应用程序 ID、相同的令牌

发布于 2024-12-07 17:17:11 字数 518 浏览 1 评论 0原文

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

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

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

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

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

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

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

请给我有关问题的建议。提前致谢。

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.

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).

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巡山小妖精 2024-12-14 17:17:11

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

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

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, 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.

守望孤独 2024-12-14 17:17:11

对于开发配置文件,该设备上使用开发配置文件的所有其他应用程序的设备令牌将相同。

据我所知,在生产环境(应用程序商店)中,每个应用程序的设备令牌都是唯一的。但我不是100%确定。

至于为什么推送通知没有发送到您的设备,如果没有更多细节,很难回答。

For development provisioning profiles, the device token will be the same for all other apps on that device using a development provisioning profile.

In production (the App Store), the device token will be unique for each application as far as I know. But I'm not 100% certain.

As for why the push notification wasn't delivered to your devices, that's hard to answer without more detail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文