【发布时间】:2016-01-22 02:12:19
【问题描述】:
我将本地通知设置为从应用程序启动后 1 秒开始,然后每天在该时间开始,由于某种原因它正在工作,我什至没有收到初始通知,有人可以帮我吗? Code Screenshot
【问题讨论】:
-
工作正常还是不工作?
标签: ios swift2 uilocalnotification
我将本地通知设置为从应用程序启动后 1 秒开始,然后每天在该时间开始,由于某种原因它正在工作,我什至没有收到初始通知,有人可以帮我吗? Code Screenshot
【问题讨论】:
标签: ios swift2 uilocalnotification
你有没有添加这个代码
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!")
}
【讨论】: