Hi , We were following these links to add push notification to our cross platform project (IOS and Android).
https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/push-notifications/quickstart
and
We were able to easily setup for Android it worked very well with FCM.
But when we built the project for IOS using Unity's Package for Push notification. (As FCM is not supported for IOS)
https://docs.unity3d.com/Packages/com.unity.mobile.notifications@1.2/manual/index.html
----------------------------------------------------------Side Note------------------------------------------------------------
We also use this plugin because UnityEngine.iOS.NotificationServices.deviceToken was always null even after 3 seconds after calling UnityEngine.iOS.NotificationServices.RegisterForNotifications.
And having no proper callback we thought was not reliable any way to poll for the deviceToken, while not knowing whether RegisterForNotification was successful or not.
----------------------------------------------------------End of Side Note----------------------------------------------------
Then we ran into problem mentioned here
After that we were able to remove Firebase Messaging while building to IOS platform, even then we are facing same problem mentioned in above link.
But note that we are able to get notification on IOS device, via some service like
https://www.apnstester.com/apns/
Which makes us believe this might be a bug with Cross-platform message routing (PlayFab via Amazon Simple Notification Service [SNS]). As mentioned in Quickstart.
Answer by Shivaprasad · May 11, 2020 at 09:22 PM
Issue was cause by miss match in .pem file and singing certificate used.
Answer by Sarah Zhang · May 11, 2020 at 06:45 PM
We have followed this tutorial -- Push Notifications For iOS to test pushing notifications for iOS. It works fine, the alert message would pop up when the application starts. After users choose "allow to push notification", the application can go on. The Client API RegisterForIOSPushNotification and SendPushNotification both can work. We also test to use this sample with the Unity Mobile Notifications Plugin, it works fine too. You can try to refer to the following sample code.
using System.Collections; using PlayFab; using PlayFab.ClientModels; using Unity.Notifications.iOS; using UnityEngine; public class TestNotification : MonoBehaviour { void Start() { StartCoroutine(RequestAuthorization()); } IEnumerator RequestAuthorization() { using (var req = new AuthorizationRequest(AuthorizationOption.Alert | AuthorizationOption.Badge, true)) { while (!req.IsFinished) { yield return null; }; string res = "\n RequestAuthorization: \n"; res += "\n finished: " + req.IsFinished; res += "\n granted : " + req.Granted; res += "\n error: " + req.Error; res += "\n deviceToken: " + req.DeviceToken; Debug.Log(res); PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest { CustomId = "[YourCustomId]", CreateAccount = true, TitleId = PlayFabSettings.TitleId }, OnLoginSuccess, OnPlayFabError); } } private void OnLoginSuccess(LoginResult obj) { byte[] token = UnityEngine.iOS.NotificationServices.deviceToken; if (token != null) { RegisterForIOSPushNotificationRequest request = new RegisterForIOSPushNotificationRequest(); request.DeviceToken = System.BitConverter.ToString(token).Replace("-", "").ToLower(); PlayFabClientAPI.RegisterForIOSPushNotification(request, (RegisterForIOSPushNotificationResult result) => { Debug.Log("Push Registration Successful"); }, OnPlayFabError); } else { Debug.Log("Push Token was null!"); } } private void OnPlayFabError(PlayFabError error) { Debug.Log(error.GenerateErrorReport()); } }
For more advanced questions about Unity Notification Plugins, please navigate to the Unity forum for professional supports. For more information on how to send push notifications to a device and how to add push notification support to your app, see the Apple Developer website documentation.
This should actually be not working...Because on the latest XCode / IOS (13.x.x) give token description instead of token it self, in following format.
{ length = 32, bytes = 0xd3d997af 967d1f43 b405374a 13394d2f ... 28f10282 14af515f }
Please let me know if you are getting the token properly on IOS 13, i might be able to remove preview package of unity notification.
Also on Unity 2017.16
UnityEngine.iOS.NotificationServices.deviceToken;
is not byte[] rather it is string.
Also in playfab version wise documentation if this is maintained , that will be greate.
The test environment is Unity 2019.3, the latest Xcode, iOS 10. Thanks for your sharing.
Receiving "PlatformApplication does not exist" when setting iOS Push Notifications 2 Answers
[UNITY] Namespace errors on PlayFab when switching from iOS/Android to PC/Mac build 1 Answer
I can't log in with Playfab Editor Extensions 2 Answers
Using custom account recovery email template doesn't work 2 Answers