Reputation: 987
To load .ics file from url I am using open url method as below
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:fullURL]];
It's working fine. But I want to load .ics file from application's bundle without URL. eg., I have file is test.ics file How can I load this file, can we load anyway it without URL?
Upvotes: 0
Views: 477
Reputation: 45500
You can load the ics
file locally
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;
}
Upvotes: 3