我怎样才能让UIDocumentInteractionController显示日历作为打开一个.ics文件的选项?

我正在截取我在我的应用程序中使用的webview中的URLtypes,以下载它链接到的文件,而不是试图在web视图中打开它。 链接是一个.ics文件。 因此,我将该文件下载到临时目录中,然后在UIDocumentInteractionController实例中调出该文件,但Calendar并未显示为打开该.ics文件的应用程序之一,只是Mail,DropBox和“Copy”。

正如你可以在下面的代码注释行中看到,我已经尝试使用前面的webcal://而不是http://来打开链接,还要手动设置UIDocumentInteractionController的UTI无效。 是否有一些原因我的本地.ics文件不会显示日历作为打开它的选项?

//Test for link to an ics file if ([urlToLoad rangeOfString:@"GetSingleEventCalendarFile" options:NSCaseInsensitiveSearch].location != NSNotFound) { //urlToLoad = [urlToLoad stringByReplacingOccurrencesOfString:@"http" withString:@"webcal"]; //NSData *contact = [NSData dataWithContentsOfURL:[NSURL URLWithString:webCalProtocol]]; //return NO; NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlToLoad]]; [NSURLConnection sendAsynchronousRequest:req queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *resp, NSData *respData, NSError *error){ NSString *urlString = [req.URL absoluteString]; NSString *actIdAndRest = [urlString substringFromIndex:[urlString rangeOfString:@"="].location + 1]; NSString *actId = [actIdAndRest substringToIndex:[actIdAndRest rangeOfString:@"&"].location]; NSString *fileName = [[@"activity" stringByAppendingString:actId] stringByAppendingString:@".ics"]; NSString * path = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName]; NSError *errorC = nil; BOOL success = [respData writeToFile:path options:NSDataWritingFileProtectionComplete error:&errorC]; if (success) { NSBundle * bundleContaining = [NSBundle bundleWithPath:NSTemporaryDirectory()]; NSLog(@"%@", bundleContaining); NSURL *fileURL = [bundleContaining URLForResource:fileName withExtension:@"ics"]; documentController = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; //documentController.UTI = @"ics"; [documentController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES]; } else { NSLog(@"fail: %@", errorC.description); } }]; }