iOS8中特定日期的本地通知

时间:2015-04-30 19:31:33

标签: ios objective-c notifications xcode6

我希望在特定日期在我的应用上显示本地通知,例如,我希望通知显示在该月的所有1个月中。

我有这个代码,我该如何自定义它?

//LOcal Notification

    NSDate *today = [NSDate new];
    NSCalendar *gregorian =
    [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];

    NSDateComponents *offsetComponents = [NSDateComponents new];
    [offsetComponents setDay:???];
    [offsetComponents setHour:10];
    [offsetComponents setMinute:0];

    NSDate *thedate = [gregorian dateByAddingComponents:offsetComponents
                                                  toDate:today options:0];
    UILocalNotification* localNotification = [[UILocalNotification alloc] init];
    localNotification.fireDate = thedate;
    localNotification.alertBody = @"Hey, il serait temps de faire un point non ? \ue104";
    localNotification.timeZone = [NSTimeZone defaultTimeZone];
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
    //END

格里高利历上ios8的折旧错误太多了,我该如何解决呢?

0 个答案:

没有答案