Tag: unnotificationrequest

本地通知声音,但不显示(Swift)

我正在尝试使用Apple的UNUserNotificationCenter为我的应用程序创build本地通知。 这是我的代码: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = task.name content.body = task.notes content.sound = UNNotificationSound.default() let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) let request = UNNotificationRequest(identifier: task.UUID, content: content, trigger: trigger) center.add(request) { (error:Error?) in if let theError = error { print("Notification scheduling error: \(error)") }else{ print("Notification was scheduled successfully") } […]

在iOS 10中限制本地通知(UNNotificationRequest)

我知道UILocalNotification的本地通知的限制是64。 它是用Apple Dev Docs编写的。 但是UILocalNotification在iOS 10中被弃用。相反,Applebuild议使用UNNotificationRequest 。 但是, 苹果开发者文档没有提到限制通知的数量。 我发现这个答案 ,但它没有链接到苹果开发文档或类似的东西(这只是一个意见)。 有没有人知道当地通知的限制? 也许有人知道与Dev Docs的链接,或者是否有苹果对此的官方回应?

如何在iOS 10 UserNotifications上设置NSCalendarUnitMinute repeatInterval?

在UILocalNotification我们使用NSCalendarUnitMinute像重复…..但我找不到iOS 10 UserNotification文档 …我怎样才能使用NSCalendarUnitMinute像在iOS 10 UserNotification重复? 这里是在晚上8点30分安排当地通知的代码,并在每一分钟后重复。 UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = pickerDate; localNotification.alertBody = self.textField.text; localNotification.timeZone = [NSTimeZone defaultTimeZone]; localNotification.repeatInterval = NSCalendarUnitMinute; localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1; [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];