Local Notification alternative week repeat
Asked Answered
D

2

3

I Have two notification and I want to repeat it alternative week.

E.g. One notification set on 1st week's monday and it should repeat on 3rd week's monday. Second notification set on 2nd week's tuesday and it should repeat on 4th week's tuesday.

What should I do for this?

Doorbell answered 29/10, 2012 at 5:30 Comment(6)
What have you tried?Subconscious
notif.repeatInterval = NSWeekCalendarUnit*2;Doorbell
Try adding 14 days to the current day , that might get you to the alternate week day of your current date..Thurber
I tried it but what about after 14 days.Doorbell
Need this repeat continue after 14 days like 1st,3rd,5th,7th and so on.....Doorbell
@Chirag, add the code you tried to the question.Troup
T
0

Get week number and make decision according to week number

Transmute answered 2/11, 2012 at 12:2 Comment(0)
T
0
-(NSString*) getWeekOfMonth {
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
 [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
 [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
 [dateFormatter setDateFormat:@"W"];

 NSString *weekNumber = [dateFormatter stringFromDate:[NSDate date]];    
 [dateFormatter release];    
 return weekNumber;
}

NSInteger weekInt = [weekNumber integerValue];
Transmute answered 2/11, 2012 at 12:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.