【发布时间】:2019-12-11 09:35:14
【问题描述】:
var acceptAction = UNNotificationAction.FromIdentifier("AcceptAction", "Accept", UNNotificationActionOptions.None);
var declineAction = UNNotificationAction.FromIdentifier("DeclineAction", "Decline", UNNotificationActionOptions.None);
// Create category
var meetingInviteCategory = UNNotificationCategory.FromIdentifier("MeetingInvitation",
new UNNotificationAction[] { acceptAction, declineAction }, new string[] { }, UNNotificationCategoryOptions.CustomDismissAction);
// Register category
var categories = new UNNotificationCategory[] { meetingInviteCategory };
UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet<UNNotificationCategory>(categories));
如何接收自定义的可操作推送通知以及需要将上述代码放在哪个文件中?
【问题讨论】:
-
应用程序启动后,应通过将上述代码添加到 AppDelegate 的 FinishedLaunching 方法并设置所需的通知类型 (UNAuthorizationOptions) 来请求通知权限。检查docs.microsoft.com/en-us/xamarin/ios/platform/…
-
我会把它作为答案发布,你能接受吗?会帮助更多的人。
标签: c# xamarin push-notification xamarin.ios apple-push-notifications