简体   繁体   English

交互式提醒选项在iOS中不可见

[英]Interactive reminder options not visible in iOS

I have implemented interactive reminders for local notifications. 我已经为本地通知实施了交互式提醒。 But those interactive options are visible only when device is unlocked and user pulled down the reminders just after receiving. 但是,只有在设备解锁并且用户在收到通知后立即拉下提醒时,这些交互选项才可见。 The first image show just after receiving local notification. 收到本地通知后立即显示第一个图像。

刚收到

If you swipe it left or right nothing happen. 如果向左或向右滑动,则不会发生任何事情。 But if you pull down, then you can see the two interactive options. 但是,如果您下拉列表,则可以看到两个交互选项。 Just like in the second image. 就像第二张图片一样。

在此处输入图片说明

(Q1.) Actually, my first question is why it just show only two options while I have declared three interactive options? (问题1)实际上,我的第一个问题是,为什么在我声明了三个交互式选项的情况下仅显示两个选项?

Below is my related code for that. 下面是我的相关代码。

UIMutableUserNotificationCategory *notificationCategory = [[UIMutableUserNotificationCategory alloc] init];
notificationCategory.identifier = mutableUserNotificationCategoryId;
[notificationCategory setActions:@[notificationAction1, notificationAction2, notificationAction3] forContext:UIUserNotificationActionContextDefault];
[notificationCategory setActions:@[notificationAction1, notificationAction2, notificationAction3] forContext:UIUserNotificationActionContextMinimal];

NSSet *categories = [NSSet setWithObjects:notificationCategory, nil];

UIUserNotificationType types = (UIUserNotificationTypeSound | UIUserNotificationTypeAlert);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
[application registerUserNotificationSettings:settings];

(Q2.) My second question is, why we can't see interactive options when user swipe the notification in any other stage. (第2季度。)我的第二个问题是,为什么用户在任何其他阶段滑动通知时都看不到交互选项。 (Ex. notification shows under notification center) Please see my next images that I've uploaded. (示例通知显示在通知中心下方)请查看我上传的下一张图像。

在此处输入图片说明 在此处输入图片说明

If using UIUserNotificationActionContextMinimal then notification alert will display no more than 2 custom actions for this context. 如果使用UIUserNotificationActionContextMinimal则通知警报将为此上下文显示不超过2个自定义操作。 Docs 文件

On 3D-touch-enabled devices, notification alert actions are available when pulling down the alert or using the 3d-touch gesture. 在启用3D触摸的设备上,当下拉警报或使用3d触摸手势时,通知警报操作可用。 The way you want to view custom actions is available for non 3d-touch devices. 非3d触摸设备可以使用您想要查看自定义动作的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM