登录iCloud帐户后如何获取本地日历? [英] How can I get the local calendar after log in iCloud account?

查看:189
本文介绍了登录iCloud帐户后如何获取本地日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 iOS Calendar(EventKit)时遇到问题。当我登录 EKEventStore (类型为 EKSourceTypeLocal )中。 > iCloud 帐户,我无法获得之前创建的活动女巫。

I met a problem when using the iOS Calendar(EventKit). My Calendar Event is created and stored in the EKEventStore(Type is EKSourceTypeLocal), when I login iCloud account, I can't get the event witch I created before.

可以,当我登录 iCloud时,它表示我可以将本地设备数据合并到 iCloud Clendar 选择,本地设备数据将合并在 iCloud 中,然后我可以使用事件类型' EKSourceTypeCalDAV ,但我不想将其同步到我的 iCloud 日历。

Sure,when I login iCloud,It said that I can merge my local device data to iCloud Clendar,if I choose YES,the local device data will be merged in iCloud,Then I can find my event using event type 'EKSourceTypeCalDAV',But I don't want sync it to my iCloud calendar.

我在任何地方都找不到本地事件(如果不合并到 iCloud )..请帮助,谢谢!

I can't find my local event anywhere(If don't merge to iCloud)..please help,thanks!

推荐答案

- (BOOL)isICloudAccountLogin {
    for (EKSource *tempSource in self.eventStore.sources) {
        if (tempSource.sourceType == EKSourceTypeCalDAV && [tempSource.title isEqualToString:@"iCloud"]) {
            EKSource *localSource = [self sourceInEventStore:[EventManager getInstance].eventStore sourceType:EKSourceTypeCalDAV sourceTitle:@"iCloud"];
            NSArray *calendarArray = [self getAllCategoryOfCalendarBySource:localSource andCalendarType:EKCalendarTypeCalDAV andEventType:EKEntityTypeEvent];
            if ([calendarArray count] <= 0) {
                return NO;
            }
            return YES;
        }
    }
    return NO;
}

我使用此代码检查iCloud帐户是否已登录。并处理其他过程在不同的EKSource中。

I use this code to check if iCloud Account has login.And handle other process in different EKSource.

这篇关于登录iCloud帐户后如何获取本地日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆