在iOS App中打开.ics文件 [英] Open .ics file in iOS App

查看:499
本文介绍了在iOS App中打开.ics文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to open a .ics file in my app.

我试图这样打开它:

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

但是什么也没发生.

如何打开.ics文件?

How do I open the .ics file?

推荐答案

我只使用了以下代码:

- (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 App中打开.ics文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆