iOS FAQs

Last updated: 2020-02-25 18:02:07

PDF

The push message could not be received?

Message push involves various associated modules, and exception in any steps can lead to message delivery failure. Below are the most common issues:

Client troubleshooting

  • Check the notification setting of the device
    Please go to Notifications > App name And check whether your app has enabled message push.
  • Check the network setting of the device
    Network issues may cause the client to fail to obtain the device token when registering for APNs, which prevents TPNS from pushing messages to specified devices.

Even when the client has correctly obtained the token, registered it with backend TPNS, and TPNS server has successfully delivered a message, the client still cannot receive the message if the device is not connected to the internet. The client can still receive the message if the device reconnects to the internet within a short time. APNs will retain the message for a while before delivering another message.

SDK integration problem. After integrating the SDK, make sure you get the identifier (Device Token) for receiving messages. For more information, see [ IOS SDK integration guide].

Server troubleshooting

  • APNs server problem
    As a message sent to an iOS device by the TPNS server is delivered via the APNs service, if APNs fails, the request sent by the TPNS server to APNs to deliver a message to the device will fail.
  • Problems with Tencent Mobile push Server
    TPNS server achieves message delivery through the collaboration of multiple feature modules. If any of these modules have an exception, message push will fail.

Push certificate troubleshooting

When the TPNS server requests the APNs to deliver the message, it needs to use two required parameters: the message push certificate and the device token. When pushing the message, please make sure that the message push certificate is valid.

Why account/tag binding and unbinding do not work?

When SDK APIs are used to bind or unbind account/tag, the TPNS server needs about 10 seconds to synchronize data.

The device prompts an error that no valid 'aps-environment' entitlement string found for application

Check whether the bundle ID configured in the Xcode project matches the configured Provision Profile file and whether the Provision Profile file corresponding to the app has been configured with the message push capability.

How does the client redirect or respond based on the message content?

When iOS device receives a push message and the user clicks on the message to open the app, the app will respond differently according to the status:

  • This function will be called if the app status is "not running".

    • If launchOptions Contains UIApplicationLaunchOptionsRemoteNotificationKey , it means the user clicks on the push message and causes the app to launch.
    • If there is no corresponding key value, it means the app launch is not caused by the user's clicks on the push message, but rather clicks on the icon or other actions.
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
      {
             // Getting message content
             NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
             // Processing logically based on the message content
      }
  • If the app status is "in the foreground" or "in the background but still active":

    • In iOS 7.0, if the Remote Notification feature is used, the following handler needs to be used:

      - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
    • Based on the system version of iOS 10.0 +, if the Remote Notification feature is used, it is recommended to use the new UserNotifications Framework for processing. Please use the following two methods in the XGPushDelegate Protocol. The sample code is as follows:

      - (void)xgPushUserNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
        NSLog(@"[XGDemo] click notification");
        completionHandler();
      }
      
      // This API needs to be called when the app pushes messages in the notification panel
      - (void)xgPushUserNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
        completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
      }

How does the client play the custom push message audio?

First, on the device development side, place the audio file under the bundle directory;

  • If you use the TPNS console to create a push, enter the audio file name in Advanced settings (the full path of the audio file is not required).
  • If you use REST API call, set the sound Parameter to the audio file name (the full path of the audio file is not required).

Does iOS support offline retention of push messages?

No. When TPSN server sends a message to APNs, if APNs finds that the device is not online, it will retain the message for a while but the retention duration is not specified.

Why didn't iOS arrive at the data?

  • In versions below iOS 9.x, the operating system does not provide an API to listen to the delivery of messages at the device, so the delivery data cannot be recorded.
  • In iOS 10.0 percent, the operating system provides the Service Extension API, which can be called by the client to listen to the arrival of messages.

How to create a silent push using Tencent Mobile push server SDK?

Assign a value of 1 to content-available And do not use alert, badge, or sound.

Under the development environment of iOS13, registration occasionally does not return DeviceToken?

This problem is caused by the instability of APNs service, which can be solved by restarting Device. For more information, please see Document .