Tag: usernotificationsui

如何处理iOS 10中的用户通知操作

所以我可以安排这样的通知; //iOS 10 Notification if #available(iOS 10.0, *) { var displayDate: String { let dateFormatter = DateFormatter() dateFormatter.dateStyle = DateFormatter.Style.full return dateFormatter.string(from: datePicker.date as Date) } let notif = UNMutableNotificationContent() notif.title = "I am a Reminder" notif.subtitle = "\(displayDate)" notif.body = "Here's the body of the notification" notif.sound = UNNotificationSound.default() notif.categoryIdentifier = "reminderNotification" let today […]

iOS-如何在iOS 10中集成推送通知?

我已经使用iOS 8,9的以下代码: UIMutableUserNotificationAction *action1; action1 = [[UIMutableUserNotificationAction alloc] init]; [action1 setActivationMode:UIUserNotificationActivationModeBackground]; [action1 setTitle:@"REJECT"]; [action1 setIdentifier:NotificationActionOneIdent]; [action1 setDestructive:NO]; [action1 setAuthenticationRequired:NO]; UIMutableUserNotificationAction *action2; action2 = [[UIMutableUserNotificationAction alloc] init]; [action2 setActivationMode:UIUserNotificationActivationModeBackground];////UIUserNotificationActivationModeBackground [action2 setTitle:@"ACCEPT"]; [action2 setIdentifier:NotificationActionTwoIdent]; [action2 setDestructive:NO]; [action2 setAuthenticationRequired:NO]; UIMutableUserNotificationCategory *actionCategory; actionCategory = [[UIMutableUserNotificationCategory alloc] init]; [actionCategory setIdentifier:NotificationCategoryIdent]; [actionCategory setActions:@[action1, action2] forContext:UIUserNotificationActionContextDefault]; NSSet *categories = [NSSet setWithObject:actionCategory]; UIUserNotificationSettings […]