Cannot send iOS notifications from Azure notification hub.

Saksun Young 6 Reputation points
2022-04-12T10:38:36.06+00:00

We're able to send notifications to iOS devices from FCM, but not from Azure notification hub.

When sending a test notification to iOS devices, we get either "Message was successfully sent, but there were no matching targets" or "The Push Notification System handle for the registration is invalid". These 2 errors seem to switch sporadically.

The config for the FCM project's iOS app is the same as for the Azure notification hub.

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
266 questions
{count} vote

1 answer

Sort by: Most helpful
  1. VasimTamboli 4,420 Reputation points
    2023-05-20T04:30:00.5033333+00:00

    there are a few potential solutions to explore:

    Verify APNs credentials: Ensure that you have correctly configured the Apple Push Notification service (APNs) credentials within your Azure Notification Hub. Double-check the APNs certificate and key to ensure they are valid and properly configured.

    Check device registration: Confirm that the iOS devices you are targeting are registered correctly with Azure Notification Hub. The device tokens obtained from APNs should be registered in the hub to receive notifications.

    Ensure correct target platform: Make sure you are specifying the correct target platform when sending notifications. For iOS, the target platform should be set to "apns" or "apns-voip" depending on your requirements.

    Check registration expiration: If you receive the error message "The Push Notification System handle for the registration is invalid," it might indicate that the device registration has expired. Ensure that you are refreshing and updating the device registrations in Azure Notification Hub as needed.

    Validate FCM configuration: While the FCM project's iOS app config might be the same as Azure Notification Hub, it's important to ensure that the FCM configuration is correct. Double-check the FCM settings for iOS and verify that the FCM server key and configuration are accurately configured in Azure Notification Hub.

    Test with a different notification payload: Try sending a simple test notification with minimal payload data to rule out any issues related to the notification content. Simplifying the payload can help isolate the problem.

    Review logs and diagnostics: Check the logs and diagnostics provided by Azure Notification Hub to get more information about the errors and potential causes. This can provide insights into any specific issues or misconfigurations that need to be addressed.