How To Use UILocalNotification In Swift

前端 未结 6 1935
温柔的废话
温柔的废话 2021-02-06 01:59

I am trying to figure out how to setup a UILocalNotification in swift but I am not having a lot of luck. I am trying this:

var notification = UILocalNotification         


        
6条回答
  •  你的背包
    2021-02-06 02:31

    Not answering your question but worth the note:

    notification.fireDate(dateTime)
    notification.alertBody("Test")
    

    will also throw a compiler error saying that it can't find the init. do this instead

    notification.fireDate = NSDate(timeIntervalSinceNow: 15)
    notification.alertBody = "Notification Received"
    

提交回复
热议问题