-2

我想在 ios 应用程序中安排一个本地通知,使其在每年 6 月 28 日触发。我对此进行了谷歌搜索,但无法获得。怎么做?谢谢

4

1 回答 1

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];
于 2013-08-23T09:15:36.657 回答