Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9238717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:49:36+00:00 2026-06-18T07:49:36+00:00

Background Info I have a class that contains an NSDate object that is used

  • 0

Background Info

I have a class that contains an NSDate object that is used as the date of an EKEvent. The EKEvent is added to the Calendar, sometimes with an EKRecurrenceRule set, with a date that is x amount of days prior to the actual date of the event. For example, if dateOfEvent is 02/01/2013 and the user elects to be alerted 2 days prior, the event will be added to the Calendar on 01/30/2013.

Here is how I am getting the prior date:

NSDateComponents *components = [[NSDateComponents alloc] init];
components.day = ([daysPrior integerValue] * -1);
NSDate *alertDate = [[NSCalendar currentCalendar] dateByAddingComponents:components
                                                                  toDate:[myClass dateOfEvent]
                                                                 options:0];

Current Issue

When setting the EKRecurrenceRule to EKRecurrenceFrequencyMonthly it selects the day of the month from alertDate in each month. With the example above that day ends up being the 30th, however February does not have a 30th day and the event never gets added to February. How can I make it actually set the days prior in each month rather than basing it off a specific number?

Failed Attempts

I tried adding negative days to the recurrence rule hoping it would base it off of the event date I set and move backward but instead it added the event to every day on the calendar.

NSMutableArray *daysOfMonth = [[NSMutableArray alloc] init];
int x;
for (x = 0; x > -31; x--) {
    [daysOfMonth addObject:[NSNumber numberWithInt:x]];
}
EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] initRecurrenceWithFrequency:EKRecurrenceFrequencyMonthly
                                                                      interval:1
                                                                 daysOfTheWeek:nil
                                                                daysOfTheMonth:daysOfMonth
                                                               monthsOfTheYear:nil
                                                                weeksOfTheYear:nil
                                                                 daysOfTheYear:nil
                                                                  setPositions:nil
                                                                           end:nil];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:49:38+00:00Added an answer on June 18, 2026 at 7:49 am

    I decided to use an EKAlarm and added it to each event.

    EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:60 * 60 * 24 * ([daysPrior integerValue] * -1)];
    [newEvent addAlarm:alarm];
    

    This way I can add the date of the event on the calendar at its actual date and still alert the user x amount of days prior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background info: I have a windows application (in c#) that handles a custom file
Giving a little background info: Details.cshtml contains a title (uses model Category), I have
Background info I recently handed in an assigment for my class on algorithms and
I have a very subtle bug that I'm having trouble identifying. Background: We have
I have a hidden div with class hidden_thing that is positioned in the center
I have an html page which contains a div that displays the html from
I have an application that runs in the background only (by specifying LSBackgroundOnly in
I have a library with a class that, when created, will automatically scrape data
I have a custom class in Obj-C called RouteManager which contains an array of
Background info I have a query regarding a questions from Sierra & Bates, SCJP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.