如何在 swift 中进行两个月的循环通知?

How can I make a loop notification for two month in swift?

我想发送两个月的本地和日程通知,一天三次。

我已经设置了用户注册后的第一条通知,但我不知道该如何继续。

    dateComps.day = registrationDate.day
    dateComps.month = registrationDate.month
    dateComps.year = registrationDate.year
    dateComps.hour = 7
    dateComps.minute = 0

    let itemDate = calendar.dateFromComponents(dateComps)

    localNotif.fireDate = itemDate!.dateByAddingTimeInterval(24*60*60)
    localNotif.timeZone = NSTimeZone.defaultTimeZone()

    localNotif.alertBody = "Good Morning new user!"
    localNotif.alertAction = "View details"
    localNotif.alertTitle = "Good morning"

一个app最多可以提前设置64条本地通知,所以实际上一天3条通知只能提前21天设置。

您最多只能在每次应用打开通话时: UIApplication.sharedApplication().scheduledLocalNotifications 并检查 fireDate 属性并根据需要安排更多通知。