---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.0
alternate:
  - https://boost.yandex.com/doc/en/analytics/content/sdk/ios/push/objectivec/AMPUserNotificationCenterHandling.md
  - https://boost.yandex.com/doc/ru/analytics/content/sdk/ios/push/objectivec/AMPUserNotificationCenterHandling.md
  - https://boost.yandex.com/doc/zh/analytics/content/sdk/ios/push/objectivec/AMPUserNotificationCenterHandling.md
  - href: https://boost.yandex.com/doc/zh/analytics/content/sdk/ios/push/objectivec/AMPUserNotificationCenterHandling.md
    type: text/markdown
    title: Markdown version
  - href: https://boost.yandex.com/doc/zh/llms.txt?revision=r21772739
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://boost.yandex.com/doc/zh/llms.txt?revision=r21772739

# AMPUserNotificationCenterHandling 协议

用于手动处理 iOS 10 及更高版本前台推送通知的代理。

使用此代理，如果您用自定义逻辑实现了[UNUserNotificationCenterDelegate](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate?language=objc)协议。 您需要实现所有 `UNUserNotificationCenterDelegate` 的方法，并在 `AMPUserNotificationCenterHandling` 中调用相应的方法。

此委托的实现由 [userNotificationCenterHandler](https://boost.yandex.com/doc/zh/analytics/content/sdk/ios/push/objectivec/AMPAppMetricaPush.md#method_userNotificationCenterHandler) 方法调用，位于 `AMPAppMetricaPush` 类.

## Instance methods {#instance_summary}

#|
|| -[userNotificationCenterWillPresentNotification:](#method_userNotificationCenterWillPresentNotification) | 您应该在 [userNotificationCenter:willPresentNotification:withCompletionHandler:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter?language=objc) 的实现中调用此方法。 ||
|| [userNotificationCenterDidReceiveNotificationResponse:](#method_userNotificationCenterDidReceiveNotificationResponse) | 您应该在 [userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter?language=objc) 的实现中调用此方法。 ||
|| -[用户通知中心打开通知设置:](#method_userNotificationCenterOpenSettingsForNotification) | 您应该在 [userNotificationCenter:openSettingsForNotification:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/2981869-usernotificationcenter?language=objc) 的实现中调用此方法。 ||
|#

## Method descriptions {#method_detail}

### -userNotificationCenterWillPresentNotification: {#method_userNotificationCenterWillPresentNotification}

```objectivec translate=no
- (void)userNotificationCenterWillPresentNotification:(UNNotification *)notification
```

您应该在 [userNotificationCenter:willPresentNotification:withCompletionHandler:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter?language=objc) 的实现中调用此方法。

**参数：**

#|
|| `通知` | [UNNotification](https://developer.apple.com/documentation/usernotifications/unnotification) 的实例. ||
|#

### -userNotificationCenterDidReceiveNotificationResponse: {#method_userNotificationCenterDidReceiveNotificationResponse}

```objectivec translate=no
- (void)userNotificationCenterDidReceiveNotificationResponse:(UNNotificationResponse *)response;
```

您应该在 [userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter?language=objc) 的实现中调用此方法。

**参数：**

#|
|| `通知` | [UNNotificationResponse](https://developer.apple.com/documentation/usernotifications/unnotificationresponse) 的实例. ||
|#

### -userNotificationCenterOpenSettingsForNotification: {#method_userNotificationCenterOpenSettingsForNotification}

```objectivec translate=no
- (void)userNotificationCenterOpenSettingsForNotification:(nullable UNNotification *)notification API_AVAILABLE(ios(12.0));
```

您应该在 [userNotificationCenter:openSettingsForNotification:](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/2981869-usernotificationcenter?language=objc) 的实现中调用此方法。

**参数：**

#|
|| `通知` | [UNNotification](https://developer.apple.com/documentation/usernotifications/unnotification)的实例。 ||
|#
