how do the X-APPLE extensions work in icalendars?

1.6k Views Asked by At

Currently I'm working on a icalendar for the calendar app of apple. When i dived deeper in the icalendars i found some X- extensions. Does someone know how the X-APPLE-STRUCTURED-LOCATION , X-APPLE-TRAVEL-DURATION AND X-APPLE-TRAVEL-START work? Here are some exemples:

BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:PUBLISH
X-WR-CALNAME:test 2
X-WR-TIMEZONE:Europe/Amsterdam
X-APPLE-CALENDAR-COLOR:#FF2968
BEGIN:VEVENT
TRANSP:OPAQUE
DTEND:20150617T193000Z
UID:[email protected]
DTSTAMP:20150617T183000Z
LOCATION:Olympus 1\n3524 WB Utrecht\nThe Netherlands
DESCRIPTION:Paulien Prent en Danielle Roumen vs. Rosa van Heesch en Lari
 ssa Nijholt
SEQUENCE:0
X-APPLE-TRAVEL-START;ROUTING=CAR;VALUE=URI;X-ADDRESS=Bingerdenallee 1\\n
 6921 JN Duiven\\nNederland;X-TITLE=Home:
TRIGGER:
X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT45M
SUMMARY:[Tennis wedstrijd] DD 17+ A
DTSTART:20150617T183000Z
CREATED:20150616T223112Z
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=Olympus 1\\n3524 WB Utre
 cht\\nThe Netherlands;X-APPLE-RADIUS=49.91307222863458;X-TITLE=Olympus 1
 :geo:52.063921,5.128511
BEGIN:VALARM
X-WR-ALARMUID:CDABC4A5-8430-48C7-8AF4-4F031DD57C6A
UID:CDABC4A5-8430-48C7-8AF4-4F031DD57C6A
TRIGGER;X-APPLE-RELATED-TRAVEL=-PT30M:-PT1H15M
DESCRIPTION:Event reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
1

There are 1 best solutions below

0
On

The X-APPLE prefix is Apple internal usage, not part of the iCal standard. Apple didn't offer an official guideline on the X-APPLE extension. What you can do is just guessing on how Apple implements it, but it don't have reliable to parse these values, because Apple can change the behavior or modify the usage of that value in the upcoming software release. (Although the chance is very small).

What is your application about? Is this necessary to handle the X-APPLE prefix? I think the X-APPLE is nice to have, but the iCal standard should be a MUST if you doing a calendar application, unless your application is tightly work with Apple's customers.

But If you working tightly with Apple, I think you should check out the EventKit's EKEvent's object.

The X-APPLE-STRUCTURED-LOCATION is the Apple way to encapsulate the location information in iCal, so that they can support adding location to the calendar event, it is not suppose to be used for developer. But the EventKit provide a well documented information for this information, you can return the potential geocoordinate from the API, you can check the documentation from here:

https://developer.apple.com/documentation/eventkit/ekevent/1507185-structuredlocation

TLDR: Don't try to understand the X-APPLE prefix, if you want to do the Apple's platform integration, do it in Apple's way, use official SDK, EventKit.