【发布时间】:2018-04-11 10:46:40
【问题描述】:
我想在 iOS 中屏幕锁定时发送本地通知。 以下是我添加的代码。但是屏幕锁定时无法收到通知
let notification = UILocalNotification()
notification.alertAction = "Go back to App"
notification.alertBody = "Phone Found..!!"
notification.fireDate = NSDate(timeIntervalSinceNow: 1) as Date
UIApplication.shared.scheduleLocalNotification(notification)
notification.soundName = UILocalNotificationDefaultSoundName
请建议,我错过了什么。 提前谢谢你。
【问题讨论】:
-
timeIntervalSinceNow: 1,您如何能够运行此代码并在一秒钟内锁定您的设备?尝试增加它,然后再试一次...可能在应用程序打开时被触发
标签: ios swift notifications localnotification