I've set my Android notifications without problem but on iOS is not working. This is what i did:
1- Install Playfab.
2- In Unity (2022.3.13f1) i also installed the "Push Notification" Package.
3- Created a Script on Unity C#.
const AuthorizationOption AUTHORIZATION_OPTION = AuthorizationOption.Alert | AuthorizationOption.Badge | AuthorizationOption.Sound;
using (var req = new AuthorizationRequest(AUTHORIZATION_OPTION, true))
{
while (!req.IsFinished)
{
yield return null;
}
if (req.Granted && req.DeviceToken != "")
{
RegisterForIOSPushNotificationRequest request = new RegisterForIOSPushNotificationRequest();
request.DeviceToken = BitConverter.ToString(Encoding.UTF8.GetBytes(req.DeviceToken)).Replace("-", "").ToLower(); ;
PlayFabClientAPI.RegisterForIOSPushNotification(request, (RegisterForIOSPushNotificationResult result) =>
{
Debug.Log("Push Registration Successful");
}, error => { IosNoti(); });
}
}
4 - Went to Unity Dashboard and set iOS push notification
5 - Then created the certificates for Push Notification (I've tried Prod and Sandbox)
6- After that i set up everything in Playfab (Tried with both certificates just in case but none of them worked) Also the code for the .pem: "openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts" didn't worked so i had to add -legacy at the end (Don't know if this is the cause of the problem)
7- Last in my xcode project and added "Push Notification", Build and send it to Testflight. When i open the app i get the pop up of "Application" Would like to send you notifications. And get the debug "Push notification Successful". But when i send a notification to all players but only android gets one. I don't know if i'm missing something or i'm doing something wrong