---
title: "set multiple UILocalNotifications in ios"  
description: "set multiple UILocalNotifications in ios"  
author: "Norman Reedus"  
published: 2014-10-28  
updated: 2014-10-28  
canonical: https://www.mindstick.com/forum/2446/set-multiple-uilocalnotifications-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "ios 7"]  
reading_time: 3 minutes  

---

# set multiple UILocalNotifications in ios

In my app I am using UILocalNotifications. I want to set notifications for different [days](https://www.mindstick.com/articles/157271/how-to-get-cloudways-free-trial-for-14-days-free) of the week.For that, I have different [dates](https://yourviews.mindstick.com/story/1513/7-zodiac-signs-astrology-dates-meanings-amp-compatibility) in an array. But I [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when) results. Is there anything wrong with my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii).**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);        }
```

## Replies

### Reply by Anonymous User

We have done something similiar to your question but i dont know it will help you or not..just try this.\

```
NSCalendar *gregCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];NSDateComponents *dateComponent = [gregCalendar components:NSYearCalendarUnit|NSWeekCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:[NSDate date]];NSArray *dobArray = [NSArray arrayWithObjects:@"02-08-2014", @"10-08-2014", @"14-08-2014", @"15-08-2014", @"16-08-2014", @"17-08-2014", @"18-08-2014", @"22-08-2014", @"28-08-2014", @"29-08-2014",nil];NSArray *messagesArray = [NSArray arrayWithObjects:@"Literacy And Numeracy workshop for parents and children", @"raksha Bandhan", @"Tri Colour Dat(School celebration)", @"Independence day (School Holiday)", @"PTM/Book Exhibition", @"Janmastami", @"Parsi New Year- School Holiday", @"Clown Day", @"Eco Friendly Ganesha-School Holiday", @"Ganesh Chaturthi-School Holiday",nil];for (NSString *dobStr in dobArray){    NSArray *components = [dobStr componentsSeparatedByString:@"-"];    if(components.count>2) {        NSInteger aDay = [[components objectAtIndex:0] integerValue];        NSInteger aMonth = [[components objectAtIndex:1] integerValue];        if(aDay == [dateComponent day] && aMonth == [dateComponent month]) { // dob is here            [dateComponent setDay:aDay];            [dateComponent setMonth:aMonth];            [dateComponent setYear:[dateComponent year]];            [dateComponent setHour:16];            [dateComponent setMinute:54];            UIDatePicker *dp = [[UIDatePicker alloc] init];            [dp setDate:[gregCalendar dateFromComponents: dateComponent]];            UILocalNotification *notification = [[UILocalNotification alloc] init];            NSInteger index = [dobArray indexOfObject:dobStr];            [notification setAlertBody:[messagesArray objectAtIndex:index]];            [notification setFireDate:dp.date];            [notification setTimeZone:[NSTimeZone defaultTimeZone]];            [application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];            return YES;        }    }}
```


---

Original Source: https://www.mindstick.com/forum/2446/set-multiple-uilocalnotifications-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
