0

I am facing strange problem, in few IPAD i am not getting prompt to access calender but in few IPAD same code is working fine and promot is displaying to access calender.

Please let me know where i am wrong. I am using Xocde 4.6.3 and running on IPAD with IOS 7.1.1

I am new to objective C, i created one hybrid app and added below code access Calender from my app.

 - (void)viewWillAppear:(BOOL)animated
 {
     // OCT15 - Demo
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    self.eventStore = [[EKEventStore alloc] init];
    self.eventsList = [[NSMutableArray alloc] init];

    if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
    {
        [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error)
        {
            calendarFlag = @"TRUE";//April16

            if (granted)
            {
                self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];
                [eventsList addObjectsFromArray:[self fetchEventsForToday:NULL]];
            }
            else
            {

            }
        }];
    }
    else
    {
        self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];
        [eventsList addObjectsFromArray:[self fetchEventsForToday:NULL]];
    }

    if (editEventFlag == TRUE)
    {
        [eventsList addObjectsFromArray:[self fetchEventsForToday:NULL]];

        [self eventsdisplay];
    }
}

I found out few things, if my ipad is having more than 1 calender in Settings > Mail, Contacts, Calendars. and make them has default everything works fine. But again if i choose calender(ios one) app won't work.

How to fix this issue?

user3231742
  • 77
  • 1
  • 2
  • 10
  • Xcode 4.6.3 is not exactly the latest version of the IDE. – dandan78 Jul 08 '14 at 09:00
  • @dandan78, yes I agree, but does it make any difference for the code i am using? – user3231742 Jul 08 '14 at 10:46
  • 1
    Well, if I remember correctly, I don't think you can build apps for iOS 7 using any version below Xcode 5. That would mean you're in fact building for iOS 6 and running on iOS 7. In general, I'd always try to use the latest version because it's one less thing to worry about. You can expect that some things will break between versions, but in your case I can't really say. – dandan78 Jul 08 '14 at 10:56

0 Answers0