forum

Home / DeveloperSection / Forums / set multiple UILocalNotifications in ios

set multiple UILocalNotifications in ios

Norman Reedus 2023 28-Oct-2014
In my app I am using UILocalNotifications. I want to set notifications for different days of the week.For that, I have different dates in an array. But I am getting wrong results. Is there anything wrong with my code.
My code is:
for(int counter=0 ;counter<[daysArray count]; counter++)
        {
            int day = [[daysArray objectAtIndex:counter] intValue];
            NSDate *specificDate = [self getDateOfSpecificDay:day];
            UILocalNotification *localNotification = [[UILocalNotification alloc]init];
            localNotification.fireDate = specificDate;
            localNotification.repeatInterval = NSWeekdayCalendarUnit;
            localNotification.soundName = sound;
            localNotification.alertBody = [NSString stringWithFormat:@"%@",specificDate];
            localNotification.alertAction = @"Show me the item";
            localNotification.timeZone = [NSTimeZone defaultTimeZone];
            localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
            [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
            NSLog(@"%@",localNotification);
        }

Updated on 28-Oct-2014

Can you answer this question?


Answer

1 Answers

Liked By