question

Maximilian Weber avatar image
Maximilian Weber asked

IOS Push not working through Playfab,iOS push not received through Playfab

I am setting up iOS PushNotifications and run into a few problems.


Through my local Xcode I can read out the deviceToken and when pasted into https://www.apnstester.com/apns/ it works and the push notification comes through.

The Playfab registerforpush stuff is successful and I can see a reference to my device and token in the player's account. The ApplePushNotificationService looks like it uses a different format than the actual device token retrieved by the client but since the registration is successful I assume this is intentional..
My device token: bc69cdcbf468bb...6f15149 (shortened)
Playfab
Notifiers Service: ...CA/d00b0dd7-3a.....51f


When testing the push functionality outside of Playfab I use the exact same .pem file I uploaded in my game manager.
When I have the game running and send a push, Playfab does not throw an error but the push never comes through.
After the game is closed Playfab says that the client has been unregistered for push notifications

Please note that I am still able to use external https://www.apnstester.com/apns/ site to successfully post push notifications.

Push Notifications
10 |1200

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

Maximilian Weber avatar image
Maximilian Weber answered

I have tried both SendPushNotificationAPI in Postman as well as the fromtemplate - postman is the exact same: it shows status 200 but after a minute or so it returns the error that it has "iOS Push Notification Failed: Client has been unregistered for push notifications." similar to the push template in the player profile

So it stll just does not seem to work with my production certificate/setup

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.

Maximilian Weber avatar image Maximilian Weber commented ·

We spent 2 whole days trying and debugging with various certificates (both dev and production) and came to the conclusion that something must be going on with our build process in Unity Cloud.
I will report back once we have further investigated this issue and share the solution for this particular setup

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ commented ·

According to my experiences, the configuration on PlayFab side seems to be working. If it is related to Unity Cloud Building, you may find this thread: https://forum.unity.com/threads/how-do-i-enable-remote-push-notification-capability-using-unity-cloud-build.457812/.

I will mark this answer first, but feel free to tell us if you any updates or question.

0 Likes 0 ·
Maximilian Weber avatar image
Maximilian Weber answered

edit: I am using TestFlight and an AppStore distribution profile with production certificates only. What bothers me is that apparently the app seems to register correctly with the PlayFab apns Service but then disconnects when it notices that the notifications are not coming through.

I feel like this might be an issue with Xcode as someone else pointed out that even the production certificate sometimes points at the sandbox stuff Inside xcode...

But then again it bothers me that I can test notifications successfully outside of PlayFab using that testing tool

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

Seth Du avatar image Seth Du ♦ commented ·

May I ask do you keep the Application foreground when testing push notification? What do you mean by "game is closed". Is it simply in background?

0 Likes 0 ·
Maximilian Weber avatar image Maximilian Weber Seth Du ♦ commented ·

I tested all the ways - app completely exited, opened, backgrounnd etc
Only the pushes fro the external tool go through

0 Likes 0 ·
Maximilian Weber avatar image Maximilian Weber Seth Du ♦ commented ·

During startup of the app Playfab has a valid connection according to the player profile and push notifications sent through the cloud script or postman return a status 200 but they never come through. After a while Postman/Playfab say "Failed to deliver to mobile device. Check that the device is registered for push notifications. Error: iOS Push Notification Failed: Client has been unregistered for push notifications.."

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Maximilian Weber commented ·

May I ask how do you get message "Failed to deliver to mobile device...."? Is it from PlayStream Event? Since you have called the API and get a 200 response. There shouldn't be passively received additional information after the initial callback is returned.

Can you provide the Title ID, test player account? In addition, are the required permissions given in Xcode Project Preference and Phone Settings. You may also refer to https://www.raywenderlich.com/8164-push-notifications-tutorial-getting-started.

0 Likes 0 ·
Show more comments

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.