我需要在我的应用中打开一个.ics文件.
我试着像这样打开它:
NSURL *path = [[NSBundle mainBundle] URLForResource:@"myIcsName" withExtension:@"ics"];
[[UIApplication sharedApplication] openURL:path];
Run Code Online (Sandbox Code Playgroud)
但什么都没发生.
我怎么打开.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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3853 次 |
| 最近记录: |