Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iphone - Multiple Apps, Different App ID, Same Token

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.

like image 501
Willy Avatar asked Nov 28 '22 03:11

Willy


2 Answers

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.

like image 54
Ivan Sanchez Avatar answered Dec 09 '22 14:12

Ivan Sanchez


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.

like image 31
August Lilleaas Avatar answered Dec 09 '22 16:12

August Lilleaas