AMPAppMetricaPush 类
- Instance methods
- Properties
- Method descriptions
- +downloadAttachmentsForNotificationRequest:
- +handleApplicationDidFinishLaunchingWithOptions:
- +handleDidReceiveNotificationRequest:
- +handleRemoteNotification:
- +handleSceneWillConnectToSession:
- +isNotificationRelatedToSDK:
- +setDeviceTokenFromData:
- +setDeviceTokenFromData:pushEnvironment:
- +setExtensionAppGroup:
- +userDataForNotification:
- Property descriptions
处理推送通知的主要类。
Instance methods
|
在推送通知中上传附件。 该方法适用于 iOS 10.0 及更高版本。 |
|
|
处理来自方法 application:didFinishLaunchingWithOptions: 的推送通知打开事件。 |
|
|
处理来自通知服务扩展的推送通知接收。 |
|
|
处理来自方法 application:didReceiveRemoteNotification:fetchCompletionHandler: 的推送通知打开。 |
|
|
处理从方法 scene:willConnectToSession:options: 打开的推送通知。 |
|
|
Returns |
|
|
为应用程序的生产环境注册设备令牌。 |
|
|
将应用程序的设备令牌注册到指定环境中。 |
|
|
为应用和通知服务扩展注册共享的 App Groups 组。 |
|
|
返回在推送通知中传递的任意数据字符串。 |
Properties
|
返回一个代理 AMPUserNotificationCenterDelegate,用于处理 iOS 10 及更高版本的前台推送通知。 |
|
|
返回一个委托 AMPUserNotificationCenterHandling,它允许你手动处理 iOS 10 及更高版本的前台推送通知。 |
Method descriptions
+downloadAttachmentsForNotificationRequest:
+ (void)downloadAttachmentsForNotificationRequest:(UNNotificationRequest *)request
callback:(AMPAttachmentsDownloadCallback)callback);
在推送通知中上传附件。 该方法适用于 iOS 10.0 及更高版本。
参数:
|
|
|
|
|
上传附件的回调块。 Format:
包括一个附件数组 |
+handleApplicationDidFinishLaunchingWithOptions:
+ (void)handleApplicationDidFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions
处理来自方法 application:didFinishLaunchingWithOptions: 的推送通知打开事件。 Method should be invoked after AppMetrica SDK初始化。
参数:
|
|
参数以“键-值”对的形式提供,包含关于应用程序启动的信息。 |
+handleDidReceiveNotificationRequest:
+ (void)handleDidReceiveNotificationRequest:(UNNotificationRequest *)request
处理来自通知服务扩展的推送通知接收。
您应该在 didReceiveNotificationRequest:withContentHandler: 的实现中调用该方法。
参数:
|
|
+handleRemoteNotification:
+ (void)handleRemoteNotification:(NSDictionary *)userInfo
处理来自方法 application:didReceiveRemoteNotification:fetchCompletionHandler 的推送通知打开。 Method should be invoked after AppMetrica SDK初始化。
参数:
|
|
推送通知的参数,以“键-值”对的形式由系统传输。 |
+handleSceneWillConnectToSession:
+ (void)handleSceneWillConnectToSessionWithOptions:(UISceneConnectionOptions *)connectionOptions
处理来自方法 scene:willConnectToSession:options: 的推送通知打开。 应在 AppMetrica SDK 初始化后调用此方法.
参数:
|
|
系统传输的 UISceneConnectionOptions 类对象,包含连接参数。 |
+isNotificationRelatedToSDK:
+ (BOOL)isNotificationRelatedToSDK:(NSDictionary *)userInfo;
Returns 是如果推送通知与AppMetrica相关。
参数:
|
|
推送通知的参数,以“键-值”对的形式由系统传输。 |
返回:
是— 如果推送通知与AppMetrica相关。否— 如果推送通知与AppMetrica无关。
+setDeviceTokenFromData:
+ (void)setDeviceTokenFromData:(nullable NSData *)data
为应用的生产环境注册设备令牌。 Method should be invoked after AppMetrica SDK初始化。
参数:
|
|
应用的设备令牌。 如果你传递 |
+setDeviceTokenFromData:pushEnvironment:
+ (void)setDeviceTokenFromData:(nullable NSData *)data
pushEnvironment:(AMPAppMetricaPushEnvironment)pushEnvironment
将应用程序的设备令牌注册到指定环境中。 Method should be invoked after AppMetrica SDK初始化。
注意
AppMetrica 允许您向 Sandbox APNs 发送推送通知。 但是,如果设备上运行了应用的不同环境版本(开发 和 生产),推送通知的处理可能会工作不正常。 为了避免这个问题,你可以为_开发_环境使用一个单独的测试 API 密钥。
参数:
|
|
应用的设备令牌。 如果你传递 |
|
|
APNs 应用环境。 |
+setExtensionAppGroup:
+ (void)setExtensionAppGroup:(NSString *)appGroup
为应用和通知服务扩展注册共享的 App Groups。
需要注册才能跟踪推送通知的送达。 要获取更多信息,请查看配置推送通知统计收集。
参数:
|
|
共享App Groups组的名称。 |
+userDataForNotification:
+ (nullable NSString *)userDataForNotification:(NSDictionary *)userInfo
返回在推送通知中传递的任意数据字符串:
- 在从 AppMetrica 界面发送时的 附加数据 字段中。
- 在
数据字段中发送时使用Push API。
参数:
|
|
推送通知的参数,以“键值对”的形式由系统传输。 |
返回:
任意数据字符串。
Property descriptions
+userNotificationCenterDelegate
@property (readonly, class) id<AMPUserNotificationCenterDelegate> userNotificationCenterDelegate;
返回一个代理 AMPUserNotificationCenterDelegate,用于处理 iOS 10 及更高版本的前台推送通知。
要处理前台推送通知,请将此代码添加到 application: didFinishLaunchingWithOptions: 方法中:
[UNUserNotificationCenter currentNotificationCenter].delegate = [AMPAppMetricaPush userNotificationCenterDelegate];
要手动处理推送通知,请使用 userNotificationCenterHandler。
+userNotificationCenterHandler
@property (readonly, class) id<AMPUserNotificationCenterHandling> userNotificationCenterHandler;
返回一个委托 AMPUserNotificationCenterHandling,用于手动处理 iOS 10 及更高版本的前台推送通知。
使用此代理,如果您用自定义逻辑实现了UNUserNotificationCenterDelegate协议。 在这种情况下,您应该实现所有 UNUserNotificationCenterDelegate 代理的方法,并在 AMPUserNotificationCenterHandling 中调用适当的方法。
为了简化推送通知处理,使用userNotificationCenterDelegate。