【问题标题】:uiLocal notification not workinguiLocal 通知不起作用
【发布时间】:2016-01-22 02:12:19
【问题描述】:

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

【问题讨论】:

  • 工作正常还是不工作?

标签: ios swift2 uilocalnotification


【解决方案1】:

你有没有添加这个代码

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!")
}

【讨论】:

  • 它打印出“收到本地通知”但没有弹出通知,请帮助
  • 很高兴它有帮助。如果您觉得它有帮助,您可以勾选答案,并让其他用户知道这实际上有帮助。祝你的项目好运!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-19
  • 2018-08-05
相关资源
最近更新 更多