This document describes how to quickly integrate TPNS into your iOS application. You can use the local tool to configure TPNS for your application in just a few clicks with no code integration required.
Preparing for Integration
- Before integrating the SDK, you need to log in to the TPNS 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.
Configuration items 1 and 2: AccessID and AccessKey
Log in to the TPNS 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
AccessKey, and paste them into the corresponding input boxes in the quick integration tool.
Configuration item 3: project language
- Please select according to the language used by the
AppDelegate.m, please select
AppDelegate.swift, please select
Configuration item 4: project file
Please select the project file with the extension of
Configuration item 5: basic push capability
Basic push capability: normal push notification capability, which does not contain features such as push data reach statistics and rich media push.
Configuration item 6: notification service extension plugin
Notification service extension: it is mainly used to count the reach rate of push data and implement features such as rich media push.
- If you are integrating TPNS 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.
Integrating TPNS SDK
- 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.
Project Structure and Configuration After Successful Integration
- If the integration is successful, the project structure and configuration will be as shown below:
- If there are exceptions such as compilation failure, no push notifications, or no reach rate statistics, please check the configuration of your project against the above figure to locate the integration error or submit a ticket for assistance.
Verifying Integration Result
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.