我将本地通知设置为从应用程序启动后的1秒开始,然后在那个时间每天开始,由于某种原因它正在运行,我甚至没有收到初始通知,有人可以帮助我吗? Code Screenshot
答案 0 :(得分:0)
您是否添加了此代码
let userNotificationTypes : UIUserNotificationType = [.Alert, .Badge, .Sound]
let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
application.registerUserNotificationSettings(settings)
进入你的AppDelegate
的didFinishLaunching函数?
您的AppDelegate
中的此代码可以处理它:
func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) {
print("local notification received!")
}