I worked through the iOS Quickstart Guide provided by google to notice, that it is outdated for a very long time already.
So I researched the whole day to find out how it is supposed to work now but I did not find a working solution / description on how to do it.
I have an iOS App with a calendar. The user can decide which calendar should be used to synchronise calendar events between app and calendar. Google Calendar and Apple Calendar should be supported. The Apple Calendar synchronisation is working perfectly. For the Google Calendar I could not find any solution yet. It should be possible for users of an google calendar to synchronize all events with our iOS app (including adding, removing and changing events).
Is there any source for that which is not outdated and which is describing on how to do it?
Google has an example app on Github here: https://github.com/google/google-api-objectivec-client-for-rest
If you dig through the app, there's an Objective-C example of creating an event, it should give you a good place to start for Swift as well:
- (void)addEvent:(GTLRCalendar_Event *)event {
GTLRCalendarService *service = self.calendarService;
GTLRCalendar_CalendarListEntry *selectedCalendar = [self selectedCalendarListEntry];
NSString *calendarID = selectedCalendar.identifier;
GTLRCalendarQuery_EventsInsert *query =
[GTLRCalendarQuery_EventsInsert queryWithObject:event
calendarId:calendarID];
self.editEventTicket = [service executeQuery:query
completionHandler:^(GTLRServiceTicket *callbackTicket,
GTLRCalendar_Event *event,
NSError *callbackError) {
// Callback
self.editEventTicket = nil;
if (callbackError == nil) {
[self displayAlert:@"Event Added"
format:@"Added event \"%@\"",
event.summary];
[self fetchSelectedCalendar];
} else {
[self displayAlert:@"Add failed"
format:@"Event add failed: %@", callbackError];
}
}];
}
Additionally, you can also use the EventKit and let the user sync their calendar as they see fit, as described here: ios Add Event to google calendar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With