问题
I need to give my manually built iCal file (.ics) some additional infos which I actually don't want to be visible for Calendar app users. Thus I need to be able to set them manually when creating an Event in an iOS application and (later) reading them from the Calendar events.
I was wondering whether it is possible to add custom fields / attributes to a iCal / .ics file itself (not by using a calendar application!). They shall not be displayed in a Calendar application but accessible for me as a mobile app developer to store IDs, references, anything when I read them out from a calendar on the device... Until now the only possibility seems to be storing those vales as description / notes, but I'm definitely not happy with that! Is there any possibilltity? Neither could I achieve it by now nor did I find anything useful on the internet...
As an alternative, I was thinking about using the Attachment function of iCal, which - unfortunately - is visible for invited persons and the organizer himself and may not be editable / updated when edited...
Thanks in advance!
Below: ics example date
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.12.2//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
DTSTART:19810329T020000
TZNAME:MESZ
TZOFFSETTO:+0200
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
DTSTART:19961027T030000
TZNAME:MEZ
TZOFFSETTO:+0100
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20170330T114118Z
UID:38F0C7FE-9711-437F-A5FE-E670E97C6766
DTEND;TZID=Europe/Berlin:20170330T160000
TRANSP:OPAQUE
ATTENDEE;CN="John Doe";CUTYPE=INDIVIDUAL;EMAIL="john@doe.de";PAR
TSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:john@doe.de
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
SUMMARY:iCal Test100
CUSTOM:*** WHAT I WOULD NEED ***
DTSTART;TZID=Europe/Berlin:20170330T153000
DTSTAMP:20170330T114208Z
ORGANIZER;CN="Jon Doh":mailto:Jon@Doh.de
SEQUENCE:0
END:VEVENT
END:VCALENDAR
回答1:
You can define your own properties and parameters. Just make sure they start with "X-". For example:
BEGIN:VEVENT
UID;X-FOO=bar:38F0C7FE-9711-437F-A5FE-E670E97C6766
X-SUPER-SECRET:abc123
...
END:VEVENT
来源:https://stackoverflow.com/questions/43117843/store-data-in-custom-fields-or-attachment-in-ics-ical-file