uiLocal 通知不起作用

uiLocal notification not working

我将本地通知设置为在应用程序启动后的 1 秒内开始,然后每天都在那个时间,由于某种原因它正在运行,我什至没有收到初始通知,有人可以帮助我吗? Code Screenshot

您是否添加了此代码

let userNotificationTypes : UIUserNotificationType = [.Alert, .Badge, .Sound]
let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)

application.registerUserNotificationSettings(settings)

进入您的 AppDelegates didFinishLaunching 函数?

然后您 AppDelegate 中的这段代码来处理它:

func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) {
    print("local notification received!")
}