title: Handling ics data in UIWebView
body: <p>I have an app which uses a UIWebView and cordova/PhoneGap. One section of the app has a 'Download Calendar' feature, which has been giving me a lot of issues on the native iOS side. The basic function of Download Calendar is an ajax call (type: POST) which returns formatted ics data. In mobile safari, this functions perfectly. A table view will slide up from the bottom and give me the option to add the listed events to my phone's calendar. I think this is just how safari normally handles ics files. Now for my issue...</p>
  
  <p>UIWebView doesn't seem to want to behave this way. When I tap "Download Calendar" nothing happens. To get the ics data, I used an NSURLConnection to get the response, and put it in an NSData structure called webData. With _webData, I'm making this call: </p>
  
  <pre><code>[self.webView loadData:_webData
                MIMEType:@"text/v-calendar"
        textEncodingName:@"utf-8"
                 baseURL:[NSURL URLWithString:@"calshow://"]];
  </code></pre>
  
  <p>In my <code>shouldStartLoadWithRequest:</code> method, I'm telling any 'calshow://' urls to open the calendar, but I don't think this gets me anywhere, since I can't pass the NSData along with it. My main question right now is, can my UIWebView mimic how safari handles this ics data? If not, can I do anything useful with this NSData? </p>
  
  <pre><code>BEGIN:VCALENDAR\r\nPRODID:-//bobbin v0.1//NONSGML iCal 
  Writer//EN\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT...
  </code></pre>
  
  <p><strong>UPDATE:</strong> I was able to get this working in a <code>UIDocumentInteractionController</code>, where it displays the dates and times exactly how safari would handle the data, however, there isn't an "Add All" button or an "Open in Calendar..." option. The UTI is correctly set to <code>com.apple.ical.ics</code>, but I'm not presented with any usable options in the view. </p>