【发布时间】:2017-05-16 19:10:45
【问题描述】:
我正在尝试使用 iOS 上的自定义分析系统跟踪推送通知的打开和关闭,但我无法获得任何 UNNotificationDismissActionIdentifier 回复。
我在通知中心注册的代码:
if([[[UIDevice currentDevice] systemVersion] integerValue] >= 10){
UNNotificationCategory* generalCategory = [UNNotificationCategory
categoryWithIdentifier:@"GENERAL"
actions:@[]
intentIdentifiers:@[]
options:UNNotificationCategoryOptionCustomDismissAction];
// Register the notification categories.
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
[center setNotificationCategories:[NSSet setWithObjects:generalCategory, nil]];
[center setDelegate:self];
};
当我发送推送通知时,我将类别设置为 GENERAL。当我收到通知并向右滑动以将其关闭时,我没有收到任何委托回调。
customDismissAction 是否仅适用于本地通知?
【问题讨论】:
-
你运气好吗?不要
customDismissAction假设您应该将一些操作传递给初始化程序? -
你能告诉我们你的有效载荷结构吗?
category是写在aps键下吗? -
您是否在整个应用程序中调用一次
setNotificationCategories?无论何时调用它,它都会替换以前的类别。因此,在注册后,您应该准备好所有类别
标签: ios objective-c notifications