Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to schedule more local notifications in iOS when notification crosses limit of 64
    text
    copied!<p>I am developing a calendar app which consists of multiple events(e.g 500 events) which consists of birthdays.I am downloading events form web service. I want to give user the alert on each birthdate at a specific time sat 10:00 AM on the birthday. I am using local notification for scheduling a alert but I am stuck as iOS allows only 64 notifications per app and I have multiple birthdays. I don't know how to schedule more notifications once the app crosses the limit. Please suggest how would I solve this problem. below is my code to schedule notifications</p> <pre><code>- (void)scheduleNotification:(NSMutableArray *)datesArray withMessage:(NSMutableArray *)messagesArray NotificationID:(NSString *)notificationID { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; [formatter setDateStyle:NSDateFormatterNoStyle]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSDateFormatter *formatter1 = [[NSDateFormatter alloc]init]; [formatter1 setDateStyle:NSDateFormatterMediumStyle]; [formatter1 setDateFormat:@"dd/MM/yyyy"]; // NSDate *myTime = [formatter dateFromString:@"06:10 PM"]; NSDate *myTime = [formatter dateFromString:fireTime]; for (int i = 0; i &lt; [datesArray count]; i++) { NSDate *myDate = [formatter1 dateFromString:[datesArray objectAtIndex:i]]; NSDateComponents *dateComponents = [calendar components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit fromDate:myDate]; NSDateComponents *timeComponents = [calendar components:NSHourCalendarUnit|NSMinuteCalendarUnit fromDate:myTime]; NSDateComponents * newComponents = [[NSDateComponents alloc]init]; NSDateComponents *todayComponents = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]]; int day = [dateComponents day]; int month = [dateComponents month]; [newCompoents setDay:[dateComponents day]]; [newCompoents setMonth:[dateComponents month]]; if (day &gt;= [todayComponents day] &amp;&amp; month &gt;= [todayComponents month]) { NSLog(@"day = %d, month = %d", day, month); [newComponents setYear:[todayComponents year]]; } else { NSLog(@"%d, %d", day, month); [newComponents setYear:[todayComponents year]+1]; } [newComponents setHour:[timeComponents hour]]; [newComponents setMinute:[timeComponents minute]]; NSDate *combDate = [calendar dateFromComponents: newComponents]; localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate = combDate; localNotif.timeZone = [NSTimeZone defaultTimeZone]; // Notification details NSString *message = [@"Wish" stringByAppendingFormat:@" %@%@", [messagesArray objectAtIndex:i],@" On His Birthday"]; localNotif.alertBody = message; // Set the action button localNotif.alertAction = @"View"; localNotif.soundName = UILocalNotificationDefaultSoundName; localNotif.applicationIconBadgeNumber = 1; // Specify custom data for the notification NSDictionary *infoDict = [NSDictionary dictionaryWithObject:notificationID forKey:notificationID]; localNotif.userInfo = infoDict; // Schedule the notification [[UIApplication sharedApplication] scheduleLocalNotification:localNotif]; } } </code></pre> <p>correct me if I am making any mistakes and suggest how to schedule more notifications once 64 limit is crossed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload