Tag: ekeventstore

EKEventEditViewController会冻结应用程序并在很长时间后加载

我在swift中有以下代码: var eventController = EKEventEditViewController() eventController.editViewDelegate = self var store = EKEventStore() eventController.eventStore = store var event = EKEvent(eventStore: store) event.title = viewModel.roleName event.location = viewModel.location event.startDate = viewModel.startDate event.endDate = viewModel.endDate eventController.event = event var status = EKEventStore.authorizationStatusForEntityType(EKEntityTypeEvent) switch status { case .Authorized: self.setNavBarAppearanceStandard() dispatch_async(dispatch_get_main_queue(), { () -> Void in self.presentViewController(eventController, animated: true, completion: […]

本地日历在iOS 10.2.1中消失

我有一个应用程序,我正在创build一个本地日历,以添加应用程序中显示的事件。检查事件types,然后添加事件的代码是标准的,如下所示: if([eventStore respondsToSelector:@selector(sources)]) { for (EKSource* source in eventStore.sources) { if (source.sourceType == EKSourceTypeBirthdays){ localSource = EKSourceTypeLocal; break; } } 在iOS 10.1中,打印事件源显示设备中存在的所有日历以及应用中存在的本地日历,如下所示: EKSource <0x1700c6e40> {UUID = 6B5927E7-78D6-418B-82D3-C06821A51758; type = Local; title = Default; externalID = (null)}, EKSource <0x1700c6740> {UUID = DE256E79-E778-44EA-99F9-0C28374F043C; type = Other; title = Other; externalID = (null)}, EKSource <0x1700c6190> {UUID = 9F735DC3-43D5-4F94-84D5-76AF832B3CB3; […]

EKCalendar中的过去事件

我试图从一个确定的EKCalendar获取所有的事件,但是如果我调用eventsMatching Predicate:用predicateForEventsWithStartDate生成一个predicateForEventsWithStartDate:endDate:calendars:和一个过去的' startDate '我得到一个空对象。 这是一个错误? 或者我无法回顾过去的事情? 编辑(NSData的declarations): [[self eventStore] predicateForEventsWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture] calendars:syncedCalendars]

为什么在requestAccessToEntity中使用performSegueWithIdentifier时使用dispatch_async:完成?

当我在完成块中调用performSegueWithIdentifier时,如果我不把这个调用包装在dispatch_async中,实际上需要10秒的时间。 但是,我可以做其他事情,而不用包装在同一个dispatch_async中,比如做核心数据工作,或者logging“事物”… 任何有关这如何工作的见解,为什么…我迷路了。 如果这不是问这个问题的地方,我很抱歉。 EKEventStore *store = [[EKEventStore alloc] init]; [store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ [self performSegueWithIdentifier:self.phaseSegue sender:self]; }); }];

saveEvent返回“没有设置日历”

我试图从我的应用程序中将事件保存到日历中。 我的代码适用于iOS 7,但在iOS 6上 ,它返回没有设置日历。 应用程序会提示用户在iOS 7上授予对日历的访问权限。但iOS 6不会显示此类提示。虽然应用程序已被授予“ 设置” – >“隐私” – >“日历”的访问权限。 是的,我已经实现了requestAccessToEntityType:completion: 。 这是我的代码片段 。 EKEventStore *objStore = [[EKEventStore alloc]init]; if ([objStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) { // iOS 6 and later [objStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ if (granted) { // code here for when the user allows your app to access […]

如果用户使用的是非iOS帐户,则可以以编程方式向日历应用添加新的日历

我们可以添加一个新的日历到默认的日历应用程序编程方式如果用户使用任何其他帐户的日历,如雅虎或Hotmail的,我越来越关注错误 “域= EKErrorDomain代码= 17”该帐户不允许添加或删除日历。“ ” 如果用户使用icould或ios日历,代码工作得很好 任何想法或build议?

在完成块中调用UIAlertView需要很长时间才能显示

我的应用程序的一部分需要日历访问,这需要调用EKEventStore方法-(void)requestAccessToEntityType:(EKEntityType)entityType completion:(EKEventStoreRequestAccessCompletionHandler)completion自iOS 7起-(void)requestAccessToEntityType:(EKEntityType)entityType completion:(EKEventStoreRequestAccessCompletionHandler)completion 。 我添加了请求,并且如果用户select允许访问,则一切运行顺利,但是如果用户拒绝访问或先前拒绝访问,则会出现问题。 我添加了一个UIAlertView来通知用户访问是否被拒绝,但是UIAlertView始终需要20-30秒才能出现,并在此期间完全禁用UI。 debugging显示[alertView show]在延迟之前运行,即使在延迟之后它不会真正显示。 为什么这个延迟发生,我怎么能删除它? [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { if (granted) { [self createCalendarEvent]; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Calendar Access Denied" message:@"Please enable access in Privacy Settings to use this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } }];

如何检测哪个EKevent发生了变化

我得到了这个问题。 我需要知道在EventStore中的事件发生了什么变化,所以在这种情况下,我使用EKEventStoreChangedNotification但是这个通知返回给我在userInfo的不可理解的字典它看起来像这样: EKEventStoreChangedObjectIDsUserInfoKey = ("x-apple-eventkit:///Event/p429" ); 我不知道如何使用这些数据访问更改的对象。 请帮帮我

EKCADErrorDomain使用calendarWithIdentifier

在我的iOS应用程序中,我用以下方法访问日历: EKCalendar* cal = [eventStore calendarWithIdentifier:[calendarIDs objectAtIndex:i]]; 通过以下方式向用户询问权限: eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted,NSError* error){} 现在这在iOS 7上正常工作,但在iOS 8上,我每次调用方法calendarWithIdentfier时都会收到以下错误: Error getting shared calendar invitations for entity types 3 from daemon: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn't be completed. (EKCADErrorDomain error 1013.)" 我可以写\读没有问题的日历,但我不明白为什么会引发这个exception。 我已经尝试了一些在这里提出的方法,但没有一个似乎在这种情况下工作。