title: EKReminder error when creating on OS X: No calendar has been set
body: <p>I have a snippet of code that is attempting to save a generic reminder, using the <code>EventKit</code> framework in OS X 10.8 and newer. Here is my code snippet:</p>
  
  <pre><code>NSLog(@"Creating reminder.");
  EKEventStore *eventStore = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityMaskReminder];
  NSLog(@"Auth status: %lu", [EKEventStore authorizationStatusForEntityType:EKEntityTypeReminder]);
  
  [eventStore requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) {
      NSLog(@"Granted: %d Error: %@", granted, error);
      if (granted) {
          EKReminder *reminder = [EKReminder reminderWithEventStore:eventStore];
          reminder.title = @"My Reminder";
          EKCalendar *reminderCalendar = [EKCalendar calendarForEntityType:EKEntityTypeReminder eventStore:eventStore];
          NSLog(@"Using EKCalendar: %@", reminderCalendar);
          reminder.calendar = reminderCalendar;
  
          NSError *commitError = nil;
          if (![eventStore saveReminder:reminder commit:YES error:&amp;commitError] || commitError) {
              NSLog(@"An error occurred committing the reminder: %@", commitError);
          } else {
              NSLog(@"Reminder created successfully.");
          }
      }
  }];
  </code></pre>
  
  <p>And here is the output I see:</p>
  
  <pre><code>2014-01-08 19:56:21.182 MyApp[6073:303] Creating reminder.
  2014-01-08 19:56:21.358 MyApp[6073:303] Auth status: 3
  2014-01-08 19:56:21.358 MyApp[6073:3423] Granted: 1 Error: (null)
  2014-01-08 19:56:21.359 MyApp[6073:3423] Using EKCalendar: EKCalendar &lt;0x9c430&gt;, calendarIdentifier:9BD66DA9-014D-4918-849A-1D6763994511, allowEvents:0, allowReminders:1, allowsContentModifications:1, isSubscribed:0, isDeletable:1, isRenameable:1, isShareable:0, defaultOrganizerIsMeForNewItems:0
  2014-01-08 19:56:21.366 MyApp[6073:3423] An error occurred committing the reminder: Error Domain=EKErrorDomain Code=1 "No calendar has been set." UserInfo=0x60000067d900 {NSLocalizedDescription=No calendar has been set.}
  </code></pre>
  
  <p>However, despite the error message, the <code>EKCalendar</code> has been successfully created/accessed, <em>and</em> set on the <code>EKReminder</code> object.</p>
  
  <p>The only other similar resources I've found for this error occur when using <code>EventKit</code> on iOS, in which the method for gaining access is slightly different.</p>
  
  <p>According to this Apple doc: <a href="https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/EventKitProgGuide/ReadingAndWritingReminders/ReadingAndWritingReminders.html" rel="nofollow">https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/EventKitProgGuide/ReadingAndWritingReminders/ReadingAndWritingReminders.html</a></p>
  
  <blockquote>
    <p>You can create reminders using the reminderWithEventStore: class
    method. The title and calendar properties are required. The calendar
    for a reminder is the list with which it is grouped.</p>
  </blockquote>
  
  <p>But I must be doing something wrong. Under my <code>App Sandbox/App Data</code> permissions, I have selected both <code>Calendar</code> and <code>Contacts</code> just to be safe, but the error seems unrelated to permissions.</p>