iCloud calendar synchronization issue while creating calendar from application

为君一笑 提交于 2019-12-04 14:58:38

Not sure if you figured this out, if you did, post your solution :-)

But it does seem to be a bug - I just checked iCal on my Mac and it's loaded up with duplicate calendars.

Just figuring it out, but some rough code I think I have working is to create a Calendar in the EKSource and then check for that Calendar.

Something like this:

-(BOOL)testCal {
  BOOL cal = 0;

  NSUInteger counter = 1;
  for (EKCalendar *thisCalendar in [[DGEK eventStore]calendars] ){
    NSLog(@"%@", thisCalendar.title);
    if ([thisCalendar.title isEqualToString:@"YourCalName"]) {
        cal = YES;
        return cal;
    }
    counter++;
  }
  return cal; 
}

I think that works. Just doing some more testing at the moment.

If the Cal doesnt exist I'm getting the default source with something like this:

source = [[[self eventStore] defaultCalendarForNewEvents] source];

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!