On this screen, for the topic ID, do we enter the bundle ID of our game, or of our notification service extension? For example if my bundle ID is com.company.game, and my notification service is set to com.company.game.ps what would I enter in this topic ID?
In the cloud messaging section of Firebase, for the IOS section, do I need to have anything here? I added the same file that I added to Unity dashboard:
In Apple’s developer dashboard, do I have to create a new ID for com.company.game.ps, or can I just let xcode manage it? Right now I created it along with a profile, but I have it checked to handle it automatically in xcode.
In xcode, I can’t choose “embed and sign” for the notification service extension, I can only choose “embed without signing” is this a problem?
The error I am getting is: Failed to register the device for remote notifications.
When the game starts I do get the popup to enable push notifications, I hit yes, but I am not getting a token back.
Has anyone had success getting IOS working with push notifications?
I am not able to register for push notifications and get a token. I have tried for both production and development builds. Also, I am not getting the green tick on the UGS dashboard where I add the keys for IOS. Not sure at all what is going wrong.
Below are my entitlements keys (aps-environment development also doesn’t work):
com.apple.developer.game-center
I opened a support ticket and was able to figure out what was going on, here’s the way to fix:
Hi Robert,
Thanks for your patience whilst we figured out what the problem was. I am pleased to be able to share a solution with you now.
The latest version of the Push Notifications package (4.0.0-pre.1) has a dependency on the Mobile Notifications package. This dependency didn’t exist on the previous version (3.0.1-pre.1). There are some additional configuration steps that we neglected to add to the PushNotifications > Get Started documentation.
When you installed Push Notifications package (4.0.0-pre.1) it will have automatically pulled in the Mobile Notifications package (v2.3.0). You should be able to check this from the ‘Packages in Project’ section of the Package Manager.
To resolve the device registration error, you will need to navigate to the Editor > Project Settings > Mobile Notifications > iOS settings page and enable notifications and device registration
Now when you call the RegisterForPushNotificationsAsync method, you should receive a device token.
// For 4.0.0-pre.1
PushNotificationsService.Instance.OnRemoteNotificationReceived += notificationData =>
{
Debug.Log(“Received a notification!”);
foreach (KeyValuePair<string, object> item in notificationData)
{
Debug.Log($“Notification data item: {item.Key} - {item.Value}”);
}
};
Debug.Log(“Attempting to Register for Remote Notifications”);
string pushToken = await PushNotificationsService.Instance.RegisterForPushNotificationsAsync();
Debug.Log("Notification Token Received = {pushToken}");
}
catch (Exception e)
{
Debug.Log(“Failed to retrieve a push notification token. :: {e.Message}”);
}
}
Apologies for the inconvenience this has caused, but thanks for bringing it to our attention. We will be updating the documentation with the additional configuration steps immediately.
The Mobile Notifications package also supports Local Notifications and some other additional functionality, you can find out more in the Mobile Notifications package documentation.
This was helpful. Thank you. While I was able to setup everything correctly (I guess) and got a Notification Sent Successfully message on the Send test page in the Unity Dashboard, I did observe two concerning things.
I never received the Push notification on the device, which was working instantly in the case of 3.0.1-pre.
In the console of XCode I see failure as well as success conditions together. Which makes me wonder whether I had done something wrong or Unity is internally making multiple calls to register for push notifications out of which one request fails but subequently the other one succeeds.
Below is the message trace from Xcode. Push Token: 6a2f1e33343f326edac9055a7f94f589221a00d91f64f24737562a9c9afe9f76 Failed to retrieve a push notification token. DeviceToken = 6a2f1e33343f326edac9055a7f94f589221a00d91f64f24737562a9c9afe9f76