我需要在我的应用中打开一个 .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/