如何在ios中的选定工作日(周一、周日)设置警报。(本地通知)

如何在ios中的选定工作日(周一、周日)设置警报。(本地通知),ios,objective-c,localnotification,Ios,Objective C,Localnotification,嗨,朋友们,我正在做一个报警应用程序,因为我需要在选定的日期重复报警(周一,周二,-)。一旦选择星期一,警报将在每个星期一触发。如何做到这一点任何朋友建议我 提前谢谢 当通知火运行此命令7周后 NSDate *localDate = [NSDate date]; NSDateFormatter *dateFormatter1 = [[[NSDateFormatter alloc]init]autorelease]; dateFormatter1.dateFormat = @"EEEE MM

嗨,朋友们,我正在做一个报警应用程序,因为我需要在选定的日期重复报警(周一,周二,-)。一旦选择星期一,警报将在每个星期一触发。如何做到这一点任何朋友建议我

提前谢谢


当通知火运行此命令7周后

   NSDate *localDate = [NSDate date];
NSDateFormatter *dateFormatter1 = [[[NSDateFormatter alloc]init]autorelease];
dateFormatter1.dateFormat = @"EEEE MMMM d, yyyy";

NSString *dateString = [dateFormatter1 stringFromDate: localDate];

NSLog(@"date:%@",dateString);
for (int i=0; i<8; i++) {


    // How much day to add
    int addDaysCount = i;

    // Creating and configuring date formatter instance
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"EEEE MMMM d, yyyy"];

    // Retrieve NSDate instance from stringified date presentation
    NSDate *dateFromString = [dateFormatter dateFromString:dateString];
    //        NSLog(@"dateFormmater:%@",dateFromString);
    // Create and initialize date component instance
    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    [dateComponents setDay:addDaysCount];

    // Retrieve date with increased days count
    NSDate *newDate = [[NSCalendar currentCalendar]
                       dateByAddingComponents:dateComponents
                       toDate:dateFromString options:0];

    NSString* weekDayString=[dateFormatter stringFromDate:newDate];
    NSLog(@"New date: %@", [dateFormatter stringFromDate:newDate]);
   //here check the selected week is in your Selectedweeks array then add notification
    }
NSDate*localDate=[NSDate-date];
NSDateFormatter*DateFormatter 1=[[[NSDateFormatter alloc]init]autorelease];
dateFormatter1.dateFormat=@“EEEE MMMM d,yyyy”;
NSString*dateString=[dateFormatter1 stringFromDate:localDate];
NSLog(@“日期:%@”,日期字符串);
对于(int i=0;i