How do I get the startDate of an event that is already on my iPhone's calendar?

I am making an app for myself and I need to access the startDate and endDate of specific events that are already in my calendar. How can I go about doing this? I have tried storing a list of events into an array but once the events are in the array, what is the point, how can I access them?

Answers


You can save the eventIdentifier property of the EKEvents in the array.

EKEventStore *eventStore = [[EKEventStore alloc] init];
// Create the predicate from the event store's instance method

NSPredicate *predicate = [store predicateForEventsWithStartDate:oneDayAgo

                                                    endDate:oneYearFromNow

                                                  calendars:nil];



// Fetch all events that match the predicate

NSArray *eventsArray = [store eventsMatchingPredicate:predicate];

for (EKEvent *eventToCheck in eventsArray) {
    if ([eventToCheck.eventIdentifier isEqualToString:[eventsIdentifierArray objectAtIndex:i]]) {
        //Do your changes here
        NSLog(@"%@", eventToCheck.startDate);
        NSLog(@"%@", eventToCheck.endDate);
    }
}

Refer this


Need Your Help

Cross-platform (linux/Win32) nonblocking C++ IO on stdin/stdout/stderr

c++ pipe stdin iostream nonblocking

I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics:

How to use coffeescript in developing web-sites?

javascript coffeescript

How do you use CoffeeScript? It need to be compiled, so - you write code in CoffeScript, compile it, and insert real JavaScript on your site?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.