ios - 在 iOS App 中打开 .ics 文件

标签 ios icalendar

我需要在我的应用中打开一个 .ics 文件。

我试过这样打开它:

NSURL *path = [[NSBundle mainBundle] URLForResource:@"myIcsName" withExtension:@"ics"];
[[UIApplication sharedApplication] openURL:path];

但什么也没有发生。

如何打开 .ics 文件?

最佳答案

我刚刚使用了以下代码:

- (IBAction)displayICS:(id)sender
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"ics"];
    NSURL *url = [NSURL fileURLWithPath:path];
    UIDocumentInteractionController *dc = [UIDocumentInteractionController interactionControllerWithURL:url];
    dc.delegate = self;
    [dc presentPreviewAnimated:YES];
}
-(UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return self;
}

关于ios - 在 iOS App 中打开 .ics 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22082043/

相关文章:

ios - Objective-C:让变量在另一个类中保持事件状态

ios - 语法错误 : Unexpected token M (when running cordova project from Visual Studio 2015)

php - php(库)中是否有任何好的 iCal 和 vCal 解析器?

database-schema - iCalendar 数据库架构

ios - 如何让工具栏和状态栏一样

ios - 如何设置系统的后退按钮(backBarButtonItem)选择器?

ios - 如何在 iOS 中的歌曲加载时间显示事件指示器

import - Google 日历不显示 S3 上托管的 iCalendar (ics) 文件中的事件

jquery - 允许 ics 在 iOS 的 phonegap 应用程序中打开

icalendar - iCal 附件中的 HTML