eventkit

Unable to create local EKCalendar (Reminders) if iCloud is set to not sync Reminders

岁酱吖の 提交于 2019-12-01 08:30:12
Hitting a very strange issue here, which seems to me to be an issue with the EventKit API and I just want to check it's nothing I'm doing. Test case 1: Reminders are enabled in Privacy for the app The device has an iCloud account, but it's set to not sync reminders I can create a local reminders list in the 'Reminders' app from Apple ISSUE - Trying to create a new calendar of entity type EKEntityTypeReminder with a source of type EKSourceTypeLocal fails Test case 2: Reminders are enabled in Privacy for the app The device has no iCloud account I can create a local reminders list in the

iOS EventKit - Event is not being deleted from calendar

点点圈 提交于 2019-12-01 08:22:46
问题 I'm deleting event using the following code [store requestAccessToEntityType:EKEntityTypeEvent completion: ^(BOOL granted, NSError *error) { if (granted) { EKEvent *event = [store eventWithIdentifier:eventIdentifier]; NSError *eventDeleteError = nil; if (event) { [store removeEvent:event span:EKSpanThisEvent error:&eventDeleteError]; } if (eventDeleteError) { NSLog(@"Event Deletion Error: %@", eventDeleteError); } }]; I got no error in eventDeleteError but following message appear in the

Unable to create local EKCalendar (Reminders) if iCloud is set to not sync Reminders

坚强是说给别人听的谎言 提交于 2019-12-01 06:11:08
问题 Hitting a very strange issue here, which seems to me to be an issue with the EventKit API and I just want to check it's nothing I'm doing. Test case 1: Reminders are enabled in Privacy for the app The device has an iCloud account, but it's set to not sync reminders I can create a local reminders list in the 'Reminders' app from Apple ISSUE - Trying to create a new calendar of entity type EKEntityTypeReminder with a source of type EKSourceTypeLocal fails Test case 2: Reminders are enabled in

EventKit - App freezes when adding an EKEvent with 2 alarms (iOS 5)

不想你离开。 提交于 2019-12-01 05:53:23
I have an app that programmatically adds reminders to your iOS device's calendar. Previous to iOS 5, I could add a calendar item with two alarms thusly: EKEventStore* eventStore = [[EKEventStore alloc] init]; EKEvent* event = [EKEvent eventWithEventStore:eventStore]; // set startDate, endDate, title, location, etc. [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -5.0f]]; // 5 min [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -15.0f]]; // 15 min [event setCalendar:[eventStore defaultCalendarForNewEvents]]; NSError* error = nil; BOOL success = [eventStore saveEvent:event span

EventKit - App freezes when adding an EKEvent with 2 alarms (iOS 5)

早过忘川 提交于 2019-12-01 03:34:17
问题 I have an app that programmatically adds reminders to your iOS device's calendar. Previous to iOS 5, I could add a calendar item with two alarms thusly: EKEventStore* eventStore = [[EKEventStore alloc] init]; EKEvent* event = [EKEvent eventWithEventStore:eventStore]; // set startDate, endDate, title, location, etc. [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -5.0f]]; // 5 min [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -15.0f]]; // 15 min [event setCalendar:

Find first element matching condition in Swift array (e.g. EKSource)

假如想象 提交于 2019-11-30 12:26:54
问题 I would like to find the first EKSource of type EKSourceType.Local with a "single"-line expression in Swift. Here is what I currently have: let eventSourceForLocal = eventStore.sources[eventStore.sources.map({ $0.sourceType }) .indexOf(EKSourceType.Local)!] Is there a better way of doing this (such as without mapping and/or with a generic version of find )? 回答1: There's a version of indexOf that takes a predicate closure - use it to find the index of the first local source (if it exists), and

Add participant to an event in iOS

旧时模样 提交于 2019-11-30 09:41:09
In the EKParticipant Class reference, " Send attendees to an EKEvent object to get an array of EKParticipant objects. " OK, buy how can I send attendees to an EKEvent object? Someone give example code? The iOS reference says the following: You do not create EKParticipant objects directly. Send attendees to an EKEvent object to get an array of EKParticipant objects. Unfortunately that attendees property is read-only and the ways that these EKParticipant 's come into existence is omitted from the reference. It has lead me to believe that the only way to create new participants, is by using the

Find first element matching condition in Swift array (e.g. EKSource)

 ̄綄美尐妖づ 提交于 2019-11-30 02:46:18
I would like to find the first EKSource of type EKSourceType.Local with a "single"-line expression in Swift. Here is what I currently have: let eventSourceForLocal = eventStore.sources[eventStore.sources.map({ $0.sourceType }) .indexOf(EKSourceType.Local)!] Is there a better way of doing this (such as without mapping and/or with a generic version of find )? There's a version of indexOf that takes a predicate closure - use it to find the index of the first local source (if it exists), and then use that index on eventStore.sources : if let index = eventStore.sources.indexOf({ $0.sourceType ==

Add participant to an event in iOS

倾然丶 夕夏残阳落幕 提交于 2019-11-29 14:49:20
问题 In the EKParticipant Class reference, " Send attendees to an EKEvent object to get an array of EKParticipant objects. " OK, buy how can I send attendees to an EKEvent object? Someone give example code? 回答1: The iOS reference says the following: You do not create EKParticipant objects directly. Send attendees to an EKEvent object to get an array of EKParticipant objects. Unfortunately that attendees property is read-only and the ways that these EKParticipant 's come into existence is omitted

Receive and respond to EKEventStoreChangedNotification in the background?

前提是你 提交于 2019-11-28 13:48:42
问题 I was wondering if in iOS7, with the new API's it was finally possible to respond to a notification in the background, in my case, I have the following observer: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(storeChanged:) name:EKEventStoreChangedNotification object:eventStore]; I am receiving the notification perfectly but i need to run the app so that the selector gets called. I've browsed through the response and they say it's not possible but not sure if they