# iOS 关于通知服务扩展的使用说明

&#x20;**本文档针对 iOS 信鸽** **SDK 3.1.0 及以上 版本**&#x20;

## iOS Extension SDK API (iOS 10+)

**上报推送消息回执，此接口的目的是统计推送消息是否抵达终端**

```
/**
  @brief   信鸽推送处理抵达到终端到消息            
  @param request   推送请求
  @param appID     信鸽应用ID
  @param handler   处理消息的回执，回调方法中处理关联的富媒体文件               
  @note            关联的富媒体文件，需要在推送前端设置资源的完整URL地址，SDK内部会自动下载        
*/
  - (void)handleNotificationRequest:(nonnull UNNotificationRequest *)request
  appID:(uint32_t)appID contentHandler:(nullable void(^)( NSArray
  <UNNotificationAttachment *>* _Nullable attachments,  NSError * _Nullable
  error))handler;
```

**说明 ： 为了使用extension SDK，操作步骤如下：** 1.新增Target ![](https://2206011842-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7ju6xkNw4mtks4NksC%2Fsync%2Fff40c6ebecdca4e77d868df0a323a8250ff12624.jpg?generation=1589941745680192\&alt=media)

2.配置Target，添加依赖库文件：libXGExtension.a, libz.tbd, libsqlite3.tbd

![](https://2206011842-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7ju6xkNw4mtks4NksC%2Fsync%2Fef6cbb34564218c6da5dbe29455b65d188401370.jpg?generation=1589941745651815\&alt=media) 3.调用SDK统计上报接口 **示例**

```
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request
  withContentHandler:(void (^)(UNNotificationContent *
  _Nonnull))contentHandler {
      [[XGExtension defaultManager] handleNotificationRequest:request appID:
  <#your xg AppID#> contentHandler:nil];
      self.contentHandler = contentHandler;
      self.bestAttemptContent = [request.content mutableCopy];
      self.contentHandler(self.bestAttemptContent);
      }
```
