我已按照以下链接的步骤操作,以显示APNS推送通知中的操作按钮。 https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/enhanced-user-notifications?tabs=vsmac#working-with-notification-actions
,但通知操作按钮未在IOS设备中显示。请让我知道对代码进行任何其他操作或在info.plist文件中添加密钥。
我的代码:
//Create action
var actionID = "reply";
var title = "Reply";
var action = UNNotificationAction.FromIdentifier(actionID, title, UNNotificationActionOptions.None);
//Create category
var categoryID = "message";
var actions = new UNNotificationAction[] { action };
var intentIDs = new string[] { };
var categoryOptions = new UNNotificationCategoryOptions[] { };
var category = UNNotificationCategory.FromIdentifier(categoryID, actions, intentIDs, UNNotificationCategoryOptions.None);
//Register category
var categories = new UNNotificationCategory[] { category };
UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet<UNNotificationCategory>(categories));
我已在下面配置的设备中检查以下内容。
设备IOS版本11.4.1
MAC IOS版本10.13.4