出于某种原因,我的iOS应用不会在锁屏上显示我的通知
当我使用timeIntervalSinceNow时,通知工作正常...
但是当我为被解雇的人设定时间时,我不会在锁屏中找到它 由于某种原因,它会显示在通知中心,因此通知会被触发,只是它不会显示在锁定屏幕中。 每当触发通知时,我也会在控制台中收到此消息
从我的研究中我知道这条消息是IOS 9上发生的某种错误,但这与我的问题有关吗?
这是错误的代码
layer.feature.type = "Feature"
}
以下是适用的代码
class ViewController: UIViewController {
@IBOutlet weak var lol1: UIButton!
@IBOutlet weak var lol2: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func permission(sender: AnyObject) {
let notificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
}
@IBAction func notificatiolol(sender: AnyObject) {
let date:NSDateComponents = NSDateComponents()
date.year = 2016
date.month = 01
date.day = 12
date.hour = 5
date.minute = 57
let realDate = NSCalendar.currentCalendar().dateFromComponents(date)
let notification = UILocalNotification()
notification.fireDate = realDate
notification.alertBody = "Hey you! Yeah you! Swipe to unlock!"
notification.alertAction = "be awesome!"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "w00t"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
}
提前感谢您,如果此问题重复,请抱歉