question

info-9 avatar image
info-9 asked

iOS push doesn't work anymore after uploading new push certificate

Hi,

I have a show stopping problem with push notifications on iOS. I developed a game (Playfab title ID 617E / not published yet) and implemented push notifications, which (after some confusion) finally worked well.

Now I found a publisher and before the release I just wanted to upload a new push certificate, because the app is now managed from the publishers Apple Developer Account, and needs certificates from this account. After uploading the new push certificate the push notifications don't work anymore. The Playfab.SendPushNotification function returns

"errorMessage":
"iOS Push Notification Failed: Client has been unregistered for
push notifications."

I think my case is similar to this forum post and @Brendan already answered there that push setup is just "remarkably fragile". And "once it's working in your testing, it should not need to be re-added". I hope this is not the last word, because in practice the certificates have to be re-added each year, since they expire.

So this is, what I already tried:

  • re-generating the push certificate in the Apple Developer Dashboard und re-uploading it to Playfab according to the Playfab instruction.
  • uploading to Playfab in different ways(via PlayfabDashboard>Settings>PushNotifications>UploadButton) (via Playfab.SetupPushNotification call while preparing the *.pem file with the Playfab provided browser formating tool) (via Playfab.SetupPushNotification call while preparing the *.pem content manually)
  • doing all this after renaming my project
  • doing all this after clicking PlayfabDashboard>Settings>Push Notifications>Remove

Then I read in the apple push notification docs that the "unregistered" phrase from my error response points to a wrong "topic" that means a wrong app bundle ID (which may be saved somewhere at Amazon SNS). That could indeed be, since with the transfer to the publishers account the app got a new bundle ID. So in an act of despair I generated a completely new Playfab project (ID 937E) and added all leaderboards and cloudscripts new from scratch, because I hoped that the new project is not contaminated somehow with the old projects bundle ID (and changed the Playfab Title ID in my Unity Project accordingly). Unfortunately the same error occured:

{
 "code": 400,
 "status":"BadRequest",
 "error":"PushServiceError",
 "errorCode":1095,
 "errorMessage":"iOS Push Notification Failed: Client has been unregistered for
push notifications.",
 "CallBackTimeMS":909
}

I would be very grateful for any help. @Brendan mentioned here that he can manually remove the SNS configuration for the title...but can this give hope, since it even didn't work with a completely new Playfab project?

If it helps I can provide the *.pem file.

For completeness of information:

The Playfab.SetupPushNotifications function returns

{
"code": 200,
"status": "OK",
"data": {
 "ARN":"arn:aws:sns:us-west-2:388128039633:app/APNS/sbbysygamb"
 },
"CallBackTimeMS":969
}

The push certificate is a distribution certificate and I use "Platform = APNS" and "OverwriteOldARN = true". The app has all push permissions activated on the test device. Client test device push registration to Playfab returns success.

Push NotificationsIn-Game Economy
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Well first, you are correct that the Push setup has to match the actual project you're using in the iTunes system, which means that the Bundle ID has to be correct. And yes, using SetupPushNotification is usually the best way to reset your Push registration.

In practically every case, just walking through the steps of the iOS Push setup tutorial (https://api.playfab.com/docs/tutorials/landing-players/push-notification-basics/push-notifications-for-ios) is all that needs to be done to get unblocked. Can you please try going through those steps, from the top, and let us know either a) where you're getting blocked, with all the details on what you're trying and the issue you're seeing, or b) if everything appears to be working correctly, but you're still not seeing the Push Notifications (and you're not using the FCM plugin), re-confirm the details of your Bundle ID, Title ID, etc.? One thing to be aware of is that re-using your Push setup and Bundle ID between Title IDs isn't advisable, as it can cause issues.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

info-9 avatar image info-9 commented ·

Huugh, I found the reason. I didn't realize that xCode signs my app for APNS_sandbox, because I thought with a push production certificate it's always going for the APNS environnment. But the certificate can do both (sandbox and production), and chooses sandbox for builds from xCode via cable to test devices, and chooses production for builds that are uploaded to iTunes Connect. I went through the whole process before but somehow I got blind for that. Now its working. Thanks for answering anyway.

0 Likes 0 ·
brendan avatar image brendan info-9 commented ·

Aha - good catch!

0 Likes 0 ·
garrygaber avatar image
garrygaber answered

I am relatively sure that the issue that info-9 is having may be my issue as well.

I have setup iOS push notifications as per the instructions on the playFab site, and I get a "Push Registration Successful" when registering the app with playfab. In addition, the Notifications for my test user (my own iPad) are showing up on Playfab and I get a "Send Push Notification" box. When I click the box and send, I get no errors when running through Xcode after doing a Unity build, but I never get push notifications, and it subsequently gives me a "failed to deliver" message if I try more than once.

What should I try?

Kindest Regards,
Garry

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

garrygaber avatar image garrygaber commented ·

So a little update: I went back and made sure that I had push enabled for both distribution and development, then uploaded the dev certificate. Push now works, however my question is - do I need to upload the other certificate when I distribute my app?

0 Likes 0 ·
brendan avatar image brendan garrygaber commented ·

The Push setup with Apple and Google can be pretty fragile. I'd recommend having completely separate app names and certificates between your test and your live app. But yes, otherwise, I'd have to recommend updating your certificate to be specific to the release version of your app when you want to go live.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.