com.tencent.tpns and the latter is com.tencent.tpns.service).


pod 'TPNS-iOS-Extension', '~> Version' // If the version is not specified, the latest version of the local pod TPNS-iOS-Extension will be downloaded.
Notification Service Extension target in Application Extension type, such as XXServiceExtension.XXServiceExtension in the Podfile.
The display effect after the configuration item is added in the Podfile is as shown below:target `XXServiceExtension'doplatform:ios,'10.0'pod 'TPNS-iOS-Extension' , '~> Version' // The version must be consistent with the primary SDK (TPNS-iOS) version.end
demo > sdk > XGPushStatistics > extension directory, and obtain the XGExtension.h and libXGExtension.a files.XGExtension.h and libXGExtension.a files obtained to the notification service extension target:libz.tbdlibXGExtension.a
new_tpns_svc_ext for the first time, please run the following command in the terminal:homebrew repository of Tencent Push Notification Service. brew tap tpns/serviceExtension https://github.com/TencentCloud/homebrew-tpnsServiceExtension.git
new_tpns_svc_ext. brew install new_tpns_svc_ext
new_tpns_svc_ext "AccessID" "AccessKey" "xxx.xcodeproj"
AccessID of your Tencent Push Notification Service product AccessKey of your Tencent Push Notification Service product .xcodeprojnew_tpns_svc_ext "1600013400" "IWRNAHX6XXK6" "/Users/yanbiaomu/Developer/tencent/demo2/SDKToolObjcDemo2/SDKToolObjcDemo2.xcodeproj"
AccessID and AccessKey, go to the Tencent Push Notification Service console, choose Product Management, and click Configuration Management in the record of a target product. Then you can find AccessID and AccessKey on the page displayed.
new_tpns_svc_ext command to verify the result.If the following result is displayed after the new_tpns_svc_ext command is run in the terminal, the notification extension plugin is successfully integrated. TPNS service auto coding done!New TPNSService Extension Success
new_tpns_svc_extbrew update && brew reinstall new_tpns_svc_ext
new_tpns_svc_ext supports integrating only the notification service extension plugin TPNSService but not basic push capabilities.NotificationService into the notification extension class XGExtension.h.didReceiveNotificationRequest:withContentHandler:/**@brief //Tencent Push Notification Service processes rich media notifications and device-reached messages, that is, message receipts.@param request //Push request@param accessID //Tencent Push Notification Service application `AccessID`@param accessKey //Tencent Push Notification Service application `AccessKey`@param handler //Callback of processing messages. Process the associated rich media file in the callback method.*/(void)handleNotificationRequest:(nonnull UNNotificationRequest *)requestaccessID:(uint32_t)accessIDaccessKey:(nonnull NSString *)accessKeycontentHandler:(nullable void (^)(NSArray<UNNotificationAttachment *> *_Nullable attachments, NSError *_Nullable error))handler;
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent *_Nonnull))contentHandler {self.contentHandler = contentHandler;self.bestAttemptContent = [request.content mutableCopy];/// For clusters outside Guangzhou, please enable the corresponding cluster configuration (not required for clusters in Guangzhou)// [XGExtension defaultManager].reportDomainName = @"tpns.hk.tencent.com"; /// Cluster in Hong Kong (China)// [XGExtension defaultManager].reportDomainName = @"tpns.sgp.tencent.com"; /// Cluster in Singapore// [XGExtension defaultManager].reportDomainName = @"tpns.sh.tencent.com"; /// Cluster in Shanghai[[XGExtension defaultManager] handleNotificationRequest:request accessID:<your accessID> accessKey:<your accessKey> contentHandler:^(NSArray<UNNotificationAttachment *> * _Nullable attachments, NSError * _Nullable error) {self.bestAttemptContent.attachments = attachments;self.contentHandler(self.bestAttemptContent); // If you need to add business logic before the notification pops up, add it before calling ContentHandler.}];}


UNNotificationServiceExtension to the primary target by PID or Name.

mutable-content field in the notification content must be 1 (since Tencent Push Notification Service SDK v1.2.8.0, the APNs channel is used by default in the background, and the Tencent Push Notification Service channel is used in the foreground. To debug the notification service extension plugin, you need to make the application run in the background). If the breakpoints are executed, the debugging is successful. Otherwise, stop all targets and start over from step 1.

AccessID and AccessKey of the primary project are consistent with those of the notification service extension plugin and whether the mutable-content field in the notification content in the web console or RESTful API is 1.
Only when the two conditions checked are met, the notification service extension plugin on the client will be run, and arrival data will be reported.フィードバック