Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to send a calendar event via UIActivityViewController?

The title pretty much says it all. What follows is my best guess, but the event just doesn't appear at all.

NSArray *items = @[string, URL, (EKEvent *)[self createCalendarEvent]];
UIActivityViewController* activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:activities];
[self presentViewController:activity animated:YES completion:NULL];

Does anyone know of a way to accomplish this? Or do I have to create an ics file and send that?

like image 204
Voltron Avatar asked Nov 05 '15 06:11

Voltron


1 Answers

UIActivityViewController:

The system provides several standard services, such as copying items to the pasteboard, posting content to social media sites, sending items via email or SMS, and more.

Apps can also define custom services.

It's not (yet) possible to share an EKEvent-object nor its parent EKCalendarItem as none of the standard services provide a way to interact with this type of activity.

You should indeed create an .ics-file to share your event. It's a bit strange that iOS doesn't convert the object by itself as it do this for strings (into .txt-files).

You could however fill in a request to get this option.

like image 94
Berendschot Avatar answered Nov 11 '22 16:11

Berendschot