怎么给推送添加category从而实现action

xidanyeweiyang
2017-03-03 07:38 487 0

我想在JPush的基础上实现推送下拉,有action,为什么没有效果

        UNNotificationAction *closeAction = [UNNotificationAction actionWithIdentifier:@"close" title:@"关闭" options:UNNotificationActionOptionDestructive];
        UNNotificationAction *enterAction = [UNNotificationAction actionWithIdentifier:@"enter" title:@"进入" options:UNNotificationActionOptionForeground];
        UNNotificationAction *unLockAction = [UNNotificationAction actionWithIdentifier:@"unLock" title:@"解锁" options:UNNotificationActionOptionAuthenticationRequired];

        UNTextInputNotificationAction *inputAction = [UNTextInputNotificationAction actionWithIdentifier:@"input" title:@"输入" options:UNNotificationActionOptionAuthenticationRequired];

        UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:@"comment-reply" actions:@[inputAction,enterAction,unLockAction,closeAction] intentIdentifiers:@[] options:UNNotificationCategoryOptionNone];

        NSMutableSet *categories = [NSMutableSet set];
        [categories addObject:category];
    //        NSSet<UNNotificationCategory *> *categories;
    //        [categories setByAddingObject:category];
        entity.categories = categories;

        [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];

1个回答

热门排序