Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subscribed Calendar name has the .ics URL when opened from a UIWebView

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?

like image 643
Dave Avatar asked Nov 11 '22 20:11

Dave


1 Answers

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.

like image 94
neilco Avatar answered Nov 15 '22 07:11

neilco