每年在特定日期点燃本地通知

时间:2013-08-23 08:17:01

标签: ios

我想在ios应用程序中安排本地通知,以便每年6月28日发布。我用Google搜索但无法得到。怎么做? 感谢

1 个答案:

答案 0 :(得分:1)

使用UILocalNotification你可以做到。

试,

    UILocalNotification *notif = [[cls alloc] init];       
    NSDateFormatter *df=[[NSDateFormatter alloc]init];
    [df setDateFormat:@"dd-MM-yyyy"];
    notif.fireDate = [df dateFromString:@"28-06-2013"];
    notif.timeZone = [NSTimeZone defaultTimeZone];
    notif.alertBody = @"You Reminder";
    notif.alertAction = @"Show";
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.applicationIconBadgeNumber = 1;
    notif.repeatInterval=NSYearCalendarUnit;
    [[UIApplication sharedApplication] scheduleLocalNotification:notif];
相关问题