Skip to main content

Test APNs Remote Notifications

After completing the APNs integration steps, you can directly test whether the push notification integration is successful.

Preparing the Test App

Installation MethodDistribution MethodProfile TypePush to APNs Sandbox EnvironmentPush to APNs Production Environment
Xcode run (Simulator)////
Xcode run (Device)/DevelopmentSupported. Must use RC app's development environment App Key and APNs configuration.Not supported
IPA FileDevelopmentDevelopmentSupported. Must use RC app's development environment App Key and APNs configuration.Not supported
Third-party App Platform (e.g., Pgyer)Ad HocAd Hoc DistributionNot supportedRecommended to use RC app's production environment App Key and APNs configuration.
Third-party App Platform (e.g., Pgyer)EnterpriseEnterprise DistributionNot supportedRecommended to use RC app's production environment App Key and APNs configuration.
TestFlightApp Store ConnectApp Store DistributionNot supportedSupported, but must use RC app's production environment APNs configuration.
App StoreApp Store ConnectApp Store DistributionNot supportedSupported, but must use RC app's production environment App Key and APNs configuration.

Preparing the Push Test Environment

RC apps distinguish between development and production environments, using different App Keys. The RC server may send push requests to APNs in various combinations.

Prerequisites:

  • Use a physical device: Test with a physical device as simulators cannot receive remote push notifications.
  • Use a non-jailbroken device: Avoid jailbroken devices as they may fail to receive remote push notifications.
  • Ensure BundleID contains no wildcards: Apps with wildcard BundleIDs cannot use remote push notifications.

Packaging Guidelines:

  • When running on a device via Xcode: Use the RC app's development environment App Key. In the development environment, if using P8 or P12 certificates, the RC server only pushes to the APNs Sandbox environment. If using a P12 universal certificate, configure it to push to the APNs Sandbox environment.

  • When packaging via Development method: Use the RC app's development environment App Key. In the development environment, if using P8 or P12 certificates, the RC server only pushes to the APNs Sandbox environment. If using a P12 universal certificate, configure it to push to the APNs Sandbox environment.

  • When packaging via Ad-Hoc/TestFlight/AppStore methods: It is recommended to use the RC app's production environment App Key (requires application for production in the RC Console). For any production environment App Key, the RC server only pushes to the APNs Production environment.

    Exception: In the RC app's development environment, if using a P12 universal certificate, it can be configured to push to the APNs Production environment for testing purposes.

For reference, consult the Xcode documentation:

Testing Push Notification Receipt

It is recommended to first test push notifications using a simple one-to-one chat scenario. Follow these steps:

  1. After the app successfully connects to RC, terminate the app process.
  2. Navigate to the Console's IM Server API Debugging page, locate Messages > Message Service > Send One-to-One Message, and directly send a one-to-one message to the current app user.
  3. Check if the push notification is received on the device.

Troubleshooting

If push notifications are not received, first check the following items:

  • If the client disconnects with push notifications disabled (e.g., by calling the logout method), the login information on the RC server is completely cleared. The RC server only records offline messages but does not trigger push services.
  • If the app user is already online on Web/PC, RC considers the user online and, by default, does not send push notifications to mobile devices. If needed, you can adjust the Web/PC Online Mobile Push Receipt setting in the RC Console under Chat > Chat settings.
  • If the app user uses multiple mobile devices, the RC server only sends push notifications to the last logged-in device.

You can view message sending and receipt status, as well as specific push errors, via the Console's "Polaris":

  1. Navigate to the Console's "Polaris" [Message Flow] page, switch to the correct environment (development/production), search for messages based on the provided criteria, and click Search.

  2. On the search results page, locate the message requiring troubleshooting and click View in the "Receipt Status" column.

  3. Under Target User Message Receipt Status, check if the message has been pushed to the recipient. If issues occur, the page will display the specific reason.

  4. Refer to the following errors to verify if APNs has been correctly integrated as per the documentation:

Common Push Error CodesCauseSolution
P16The message is not a built-in RC message type (see [Message Type Overview]) and lacks push notification content (pushContent), making it unpushable.When sending custom message types that require push support, you must set pushContent when sending the message.
P17The recipient has enabled Global Do Not DisturbCheck if the corresponding feature is enabled. See [Global Do Not Disturb].
P19The recipient has enabled Do Not Disturb for this specific conversationCheck if the corresponding feature is enabled. See [Do Not Disturb Overview] or [Ultra Group Do Not Disturb Overview].
P23deviceId is emptySet deviceToken. Verify that the integration steps are complete. See Set deviceToken in [Integrate APNs Remote Push].
P60Encrypted messages are not pushedN/A
PUSH_I9Certificate loading errorCheck if the correct push certificate has been uploaded in the RC Console. Verify that the integration steps are complete. See [Integrate APNs Remote Push]. If the certificate is confirmed correct, contact RC for further troubleshooting.
Rong_DeviceToken_InvalidThe uploaded deviceToken is invalidSet deviceToken. Verify that the integration steps are complete. See Set deviceToken in [Integrate APNs Remote Push].
APNS_4_4_nullCertificate expiredCheck if the push certificate has expired. If expired, re-upload it to the RC Console. If the certificate is confirmed valid, contact RC for further troubleshooting.
APNS_A2_2400{"reason":"BadDeviceToken"}Incorrect build environmentVerify that the certificate type, configuration uploaded to the RC backend, and the provisioning file used are fully matched.
PUSH_IP8_ERRIncorrect build environmentVerify that the certificate type, configuration uploaded to the RC backend, and the provisioning file used are fully matched.
APNs_XXXPush failed after reaching Apple, where XXX is the APNs error codeRefer to Apple's official developer documentation for APNs error codes [Communicating with APNs].

You can query all Push Error Codes returned by Polaris Message Flow in the knowledge base.