My iPhone app (supporting iOS 6+) has a web view which lists events with a "Add To Calendar" button for each event. The "Add To Calendar" button is a hyperlink to an .ics file on the server. To make this work, I have modified IIS to use "text/calendar" as the MIME type for .ics files and used the following code in my UIWebView delegate's shouldStartLoadWithRequest: when the request URL contains the ".ics" path extension
[[UIApplication sharedApplication] openURL:ics_url];
When tapping on the "Add To Calendar" button for an event, I get an alert "Subscribe to the calendar "http://blah.com/pathtoics/file.ics"" with 2 buttons Subscribe and Cancel. When I tap "Subscribe", I get another alert "The Calendar "http://blah.com/pathtoics/file.ics" has been added" with 2 buttons "View Events" and "Done". When I open the Calendar app by tapping on "View Events" button, I see the event gets added but the Subscribed Calendar name is the URL "http://blah.com/pathtoics/file.ics"
Two Questions:
Is there a way to modify the alert to say "Subscribe to the calendar event Team Event 1"" i.e., the event name/description instead of the server path to the ics file? If so, how do I do that?
Is there a way to make the name of the Subscribed Calendar to be a description text that I use in the ics file instead of the path to the ics file? If so how?
In the ICS file, make sure X-WR-CALNAME
is set to the calendar name you wish to be displayed in the alert and as the name of the subscribed 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