MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

MBS Xojo Network Kit 1.0

EKEventStoreMB class:

Class EKEventStoreMB Inherits EKBaseObjectMB
ComputedProperty eventStoreIdentifier As text
Sub Get()
Returns a unique identifier string representing this calendar store.
Enum EKAuthorizationStatus NotDetermined = 0 Restricted = 1 Denied = 2 Authorized = 3 End Enum
Enum EKEntityMask Unknown = 0 Events = 1 Reminders = 2 Both = 3 End Enum
Enum EKEntityType Events = 0 Reminders = 1 End Enum
Enum EKSpan ThisEvent = 0 FutureEvents = 1 End Enum
Sub Constructor()
Creates a event store
Sub Constructor(Handle as Integer, Retain as Boolean)
Create from Handle
Sub Destructor()
Shared Function authorizationStatusForEntityType(entityType as EKEntityType) As EKAuthorizationStatus
Returns the authorization status for the given entity type
Function calendarItemWithIdentifier(identifier as text) As EKCalendarItemMB
Returns either a reminder or the first occurrence of an event.
Function calendarItemsWithExternalIdentifier(identifier as text) As EKCalendarItemMB()
Returns either matching reminders or the first occurrences of any events matching the given external identifier. This method returns a set of EKEvents or EKReminders with the given external identifier. Due to reasons discussed in EKCalendarItem.calendarItemExternalIdentifier, there may be more than one matching calendar item. externalIdentifier The value obtained from EKCalendarItem's calendarItemExternalIdentifier property An unsorted array of EKCalendarItem instances
Function calendarWithIdentifier(identifier as text) As EKCalendarMB
Returns a calendar with a specified identifier.
Function calendars() As EKCalendarMB()
Function calendarsForEntityType(EntityType as EKEntityType) As EKCalendarMB()
Returns calendars that support a given entity type (reminders, events)
Sub cancelFetchRequest(r as EKFetchRequestMB)
Given a value returned from fetchRemindersMatchingPredicate, this method can be used to cancel the request. Once called, the completion block specified in fetchReminders... will not be called.
Function commit(byref error as EKErrorMB) As Boolean
Commits pending changes to the database. If you use saveCalendar/saveEvent/removeCalendar/removeEvent, etc. and you pass NO to their parameter, you are batching changes for a later commit. This method does that commit. This allows you to save the database only once for many additions or changes. If you pass true to methods' commit parameter, then you don't need to call this method. This method will return true as long as nothing went awry, even if nothing was actually committed. If it returns false, error should contain the reason it became unhappy.
Function defaultCalendarForNewEvents() As EKCalendarMB
Returns the calendar that events should be added to by default, as set in the Settings application.
Function defaultCalendarForNewReminders() As EKCalendarMB
Returns the calendar that reminders should be added to by default, as set in the Settings application.
Function eventWithIdentifier(identifier as text) As EKEventMB
Returns the first occurrence of an event matching the given event identifier. An EKEvent object, or nil if not found.
Function eventsMatchingPredicate(predicate as EKPredicateMB) As EKEventMB()
Searches for events that match the given predicate. This call executes a search for the events indicated by the predicate passed to it. It only includes events which have been committed (e.g. those saved using saveEvent:commit:NO are not included until commit is called.) It is synchronous. If you want async behavior, you should either use dispatch_async or NSOperation to run the query someplace other than the main thread, and then funnel the array back to the main thread. predicate The predicate to invoke. If this predicate was not created with the predicate creation functions in this class, an exception is raised. An array of EKEvent objects, or nil. There is no guaranteed order to the events.
Function fetchRemindersMatchingPredicate(predicate as EKPredicateMB) As EKFetchRequestMB
Fetches reminders asynchronously. This method fetches reminders asynchronously and returns a value which can be used in cancelFetchRequest to cancel the request later if desired. The completion block is called with an array of reminders that match the given predicate (or potentially nil). This only includes reminders which have been committed (e.g. those saved using saveReminder:commit:NO are not included until commit: is called.)
Function predicateForCompletedReminders(startDate as Date, endDate as Date, calendars() as EKCalendarMB = nil) As EKPredicateMB
Fetch completed reminders in a set of calendars. You can use this method to search for reminders completed between a range of dates. You can pass nil for start date to find all reminders completed before endDate. You can pass nil for both start and end date to get all completed reminders in the specified calendars.
Function predicateForCompletedReminders(startDate as Date, endDate as Date, calendar as EKCalendarMB) As EKPredicateMB
Fetch completed reminders in a set of calendars.
Function predicateForEvents(startDate as Date, endDate as Date, calendars() as EKCalendarMB = nil) As EKPredicateMB
Creates a predicate for use with eventsMatchingPredicate or enumerateEventsMatchingPredicate:usingBlock:. Creates a simple query predicate to search for events within a certain date range. At present, this will return events in the default time zone ([NSTimeZone defaultTimeZone]). startDate The start date. endDate The end date. calendars The calendars to search for events in, or nil to search all calendars.
Function predicateForEvents(startDate as Date, endDate as Date, calendar as EKCalendarMB) As EKPredicateMB
Creates a predicate for use with eventsMatchingPredicate
Function predicateForIncompleteReminders(startDate as Date, endDate as Date, calendars() as EKCalendarMB = nil) As EKPredicateMB
Fetch incomplete reminders in a set of calendars. You can use this method to search for incomplete reminders due in a range. You can pass nil for start date to find all reminders due before endDate. You can pass nil for both start and end date to get all incomplete reminders in the specified calendars.
Function predicateForIncompleteReminders(startDate as Date, endDate as Date, calendar as EKCalendarMB) As EKPredicateMB
Fetch incomplete reminders in a set of calendars.
Function predicateForReminders(calendars() as EKCalendarMB = nil) As EKPredicateMB
Fetch all reminders in a set of calendars.
Function predicateForReminders(calendar as EKCalendarMB) As EKPredicateMB
Fetch all reminders in one calendar.
Sub refreshSourcesIfNecessary()
Cause a sync to potentially occur taking into account the necessity of it. You can call this method to pull new data from remote sources. This only updates the event store's data. If you want to update your objects after refreshing the sources, you should call refresh on each of them afterwards. On iOS, this sync only occurs if deemed necessary. On OS X, this will occur regardless of necessity, but may change in a future release to match the iOS behavior.
Function removeCalendar(calendar as EKCalendarMB, commit as Boolean, byref error as EKErrorMB) As Boolean
Removes a calendar from the database. This method attempts to delete the given calendar from the calendar database. It returns true if successful and false otherwise. Passing a calendar fetched from another EKEventStore instance into this function will raise an exception. calendar The calendar to delete. commit Pass true to cause the database to save. You can pass false to batch multiple changes and then call commit to save them all at once. error If an error occurs, this will contain a valid NSError object on exit.
Function removeEvent(theEvent as EKErrorMB, span as EKSpan, byref error as EKErrorMB) As Boolean
Removes an event from the calendar store. This method attempts to remove the event from the calendar database. It returns YES if successful and false otherwise. It's possible for this method to return false, and error will be set to nil. This occurs if the event wasn't ever added and didn't need removing. This means the correct way to detect failure is a result of NO and a non-nil error parameter. Passing an event from another CalendarStore into this function will raise an exception. After an event is removed, it is no longer tied to this calendar store, and all data in the event is cleared except for the eventIdentifier. event The event to save. span The span to use (this event, or this and future events). error If an error occurs, this will contain a valid NSError object on exit.
Function removeEvent(theEvent as EKEventMB, span as EKSpan, commit as Boolean, byref error as EKErrorMB) As Boolean
Remove event
Function removeReminder(reminder as EKReminderMB, commit as Boolean, byref error as EKErrorMB) As Boolean
Removes a reminder from the event store. This method attempts to remove the reminder from the event store database. It returns true if successful and false otherwise. Passing a reminder from another EKEventStore into this function will raise an exception. After a reminder is removed, it is no longer tied to this event store.
Sub requestAccessToEntityType(entityType as EKEntityType)
Users are able to grant or deny access to event and reminder data on a per-app basis. To request access to event and/or reminder data, call requestAccessToEntityType. This will not block the app while the user is being asked to grant or deny access. Until access has been granted for an entity type, the event store will not contain any calendars for that entity type, and any attempt to save will fail. The user will only be prompted the first time access is requested; any subsequent instantiations of EKEventStore will use the existing permissions. When the user taps to grant or deny access, the completion handler will be called on an arbitrary queue.
Sub reset()
Resets the event store. You can use this method to forget ALL changes made to the event store (all additions, all fetched objects, etc.). It essentially is as if you released the store and then created a new one. It brings it back to its initial state. All objects ever created/fetched, etc. using this store are no longer connected to it and are considered invalid.
Function saveCalendar(calendar as EKCalendarMB, commit as Boolean, byref error as EKErrorMB) As Boolean
Saves changes to a calendar, or adds a new calendar to the database. This method attempts to save the given calendar to the calendar database. It returns true if successful and NO otherwise. Passing a calendar fetched from another EKEventStore instance into this function will raise an exception. calendar The calendar to save. commit Pass true to cause the database to save. You can pass false to save multiple calendars and then call commit to save them all at once. error If an error occurs, this will contain a valid NSError object on exit.
Function saveEvent(theEvent as EKErrorMB, span as EKSpan, byref error as EKErrorMB) As Boolean
Saves changes to an event permanently. This method attempts to save the event to the calendar database. It returns YES if successful and false otherwise. It's possible for this method to return NO, and error will be set to nil. This occurs if the event wasn't dirty and didn't need saving. This means the correct way to detect failure is a result of false and a non-nil error parameter. Passing an event fetched from another EKEventStore instance into this function will raise an exception. After an event is successfully saved, it is also put into sync with the database, meaning that all fields you did not change will be updated to the latest values. If you save the event, but it was deleted by a different store/process, you will effectively recreate the event as a new event. event The event to save. span The span to use (this event, or this and future events). error If an error occurs, this will contain a valid NSError object on exit.
Function saveEvent(theEvent as EKEventMB, span as EKSpan, commit as Boolean, byref error as EKErrorMB) As Boolean
Saves event
Function saveReminder(reminder as EKReminderMB, commit as Boolean, byref error as EKErrorMB) As Boolean
Saves changes to a reminder. This method attempts to save the reminder to the event store database. It returns true if successful and false otherwise. Passing a reminder fetched from another EKEventStore instance into this function will raise an exception. After a reminder is successfully saved, its fields are updated to the latest values in the database. reminder The reminder to save. commit Whether to save to the database or not. Pass NO to batch changes together and commit with EKEventStore.commit. error If an error occurs, this will contain a valid NSError object on exit.
Function sourceWithIdentifier(identifier as text) As EKSourceMB
Returns a source with a specified identifier.
Function sources() As EKSourceMB()
Returns an unordered array of sources.
Note "About"
The EKEventStore class provides an interface for accessing and manipulating calendar events and reminders. The EKEventStore class is the main point of contact for accessing Calendar data. You must create a EKEventStore object in order to retrieve/add/delete events or reminders from the Calendar database. Events, Reminders, and Calendar objects retrieved from an event store cannot be used with any other event store. It is generally best to hold onto a long-lived instance of an event store, most likely as a singleton instance in your application.
Note "Copyright"
© 2015 by Christian Schmitz, Monkeybread Software This is part of the MBS Xojo Event Kit for iOS http://www.monkeybreadsoftware.de/xojo/
End Class




Links
Bilder aus Nickenich