This document describes how to quickly integrate Tencent Push Notification Service into your iOS application. You can use the local tool to configure Tencent Push Notification Service for your application in just a few clicks with no code integration required.
Before integrating the SDK, you need to log in to the Tencent Push Notification Service Console and create the product and iOS application. For detailed directions, please see Creating Products and Applications.
Upload the push certificate on the Configuration Management page. You can get the push certificate as instructed in Acquisition of Push Certificate.
After completing the above steps, click "Quick Integration" to download the quick integration tool.
Decompress the package and double-click TPNS Smart Tool.
The message "Unable to open TPNS Smart Tool" will be displayed.
Go to System Preferences > Security & Privacy > General and click Open Anyway.
Enter the system password as prompted to confirm the operation and click Open Anyway again after the confirmation. The Open button will be displayed. Then, click it.
After starting the quick integration tool, go to the homepage and click Start Integration.
Enter the configuration page and configure the following 6 items as detailed below.
Log in to the Tencent Push Notification Service console.
On the "Product Management" page, find the product for which to configure the push capability and select configuration management for iOS or macOS.
Enter the product configuration management details page, copy AccessID
and AccessKey
, and paste them into the corresponding input boxes in the quick integration tool.
AppDelegate
file:AppDelegate.m
, please select Objective-C
AppDelegate.swift
, please select Swift
Please select the project file with the extension of .xcodeproj
:
Basic push capability: normal push notification capability, which does not contain features such as push data reach statistics and rich media push.
Notification service extension plugin is mainly used to calculate the reach rate of pushes and implement features such as rich media push.
Xcode
, Xcode
will generate a provisioning file for your notification service extension plugin on the Apple Developer platform.Xcode
, you need to manually generate a provisioning file on the Apple Developer platform. Otherwise, the application cannot be installed on a real device for debugging. The steps are as follows:Go to the Apple Developer platform to apply for a bundle identifier for the notification service extension plugin.
Note:Bundle identifier naming rule: (main target Bundle Identifier).TPNSService.
Apply for a provisioning file containing the bundle identifier.
Specify Bundle Identifier
and Provisioning Profile
of the extension plugin as the bundle identifier and provisioning file you applied for respectively.
Note:
- If you are integrating Tencent Push Notification Service for the first time, we recommend you check items 5 and 6 at the same time; otherwise, the push reach data cannot be obtained, and rich media pushes cannot be delivered.
- You can integrate configuration item 5 or 6 separately or integrate both of them at the same time as needed by your project.
After the above 6 configuration items are set, the Quick Integration button will become blue and clickable. Then, click it.
After successful integration, the following pop-up window will be displayed.
Connect your iPhone to Xcode, install the application, and view the logs in the console. If a log similar to the one below is displayed, the client has properly integrated the SDK.
[TPNS] Current device token is 9298da5605c3b242261b57****376e409f826c2caf87aa0e6112f944
[TPNS] Current TPNS token is 00c30e0aeddff1270d8****dc594606dc184
If the token cannot be found, please check the error code returned by the registration API and troubleshoot as instructed in Error Codes.
Was this page helpful?