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?