从url加载.ics文件我正在使用下面的打开url方法
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:fullURL]];
它工作正常。 但我想从没有URL的应用程序包中加载.ics文件。例如,我的文件是 test.ics 文件如何加载这个文件,我们可以加载它而不用URL吗?
答案 0 :(得分:3)
您可以在本地加载ics
文件
NSURL *path = [[NSBundle mainBundle] URLForResource:@'icsName' withExtension:@'ics'];
[[UIApplication sharedApplication] openURL:path];
- (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;
}