I found a few questions on SO and even with answers but not one of them helped me solve the problem.
I have ICS file
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20120719T110000
DTEND:20120719T120000
LOCATION:26 - 12 Hyde Way, Welwyn Garden Centre, Hertfordshire, AL7 3UQ
DESCRIPTION:You are going to be interviewed by: Paddy Allum - Group Health & Safety Manager and Heather Hughes - Group Training Manager
SUMMARY:CreativeSchool Group Plc
PRIORITY:3
END:VEVENT
END:VCALENDAR
I tried to import it when it's local file:
NSString * path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
path = [path stringByAppendingPathComponent:#"appointment.ics"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
[[UIApplication sharedApplication] openURL:targetURL];
and from external url:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://mysite.com/appointment.ics"]];
and load directly to UIWebView but all failed. Tried both in simulator (which doesn't have Calendar app) and on device. When tried open external URL I was getting an alert "Impossible to subscribe... something blahblah"
Can anyone give me a clue if it's possible at all? Apple announced iOS 4.2 was going to support this stuff.
Related
How can I add transport type when showing Directions on map
I have used this code so far, but it is showing Walking distance on map
NSURL *URL = [NSURL URLWithString:#"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f"];
[[UIApplication sharedApplication] openURL:URL];
You can add one extra param directionsmode for different direction mode like below :
NSURL *URL = [NSURL URLWithString:#"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&directionsmode=transit"];
There are many types of direction mode :
driving
transit
bicycling
walking
Also you can use URLSchema for open app with schema like below Google Map Guide
Google Map URLSchema Guide : https://developers.google.com/maps/documentation/ios-sdk/urlscheme
I am facing an issue while dialing a call as it is automatically assigning international or local prefixes when making calls for toll free local numbers Which starts with one to ISD
NSString *phNo = #"18605003000";
NSURL *phoneUrl = [NSURL URLWithString:[NSString stringWithFormat:#"tel:%#",phNo]];
NSLog(#"in call");
if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
[[UIApplication sharedApplication] openURL:phoneUrl];
}
For above code, when Dail assist is ON, it is prefixing number and converting with +1 (860) 500-3000 which is actually a Indian toll free redirecting to ISD to call ..To avoid this I want to check whether Dail assist is ON or way to disable this programatically.
I have even referred this iOS dial assist auto formats local number to USA number but this way it is Dailing to wrong number
So can any please suggest me for possible way?
I tried the code, and had the dial assist on, but it dialed "18005003000" and did not converted to +1 (800) 500-3000
NSURL *url = [NSURL URLWithString:#"tel://18005003000"];
[[UIApplication sharedApplication] openURL:url];
I need to open a .ics file in my app.
I tried to open it like this:
NSURL *path = [[NSBundle mainBundle] URLForResource:#"myIcsName" withExtension:#"ics"];
[[UIApplication sharedApplication] openURL:path];
But nothing is happening.
How do I open the .ics file?
I just used the following code:
- (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;
}
I have found there are two projects that enable you to open an ICS file and get events, dates and other information out of it as Objective-C objects.
MXLCalendarManager seems to be a bit further along and will allow you to pull out the events from the ICS file search on date and add the events to the users iOS calendar. This might be what your looking for. GitHub Project MXLCalendarManager It also supports writing new ICS files.
I've created a project that uses the libical library written in C to parse the complete ICS file. The project is still in the early stages and could use some more tender care before its ready to just drop into a project. You can check it out at Github Project XbICalendar More details on libical can be found at GitHub Project libical
I have the following code for opening Skobbler at specified location:
- (void)openSkobblerWithLatitude:(double)latitude longitude:(double)longitude {
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:
#"hybridnavigation://cmd=mapOverview&latitude=%f&longitude=%f",
latitude,
longitude]];
[[UIApplication sharedApplication] openURL:url];
}
It opens Skobbler, but the location is completely ignored. Is there something wrong with the URL or is this simply a bug in Skobbler?
Link for downloading Skobbler:
https://itunes.apple.com/us/app/gps-navigation-sat-nav/id370144231?mt=8
EDIT: This is what the final URL looks like:
"hybridnavigation://cmd=mapOverview&latitude=49.010066&longitude=8.396355"
I contacted skobbler's support and they confirmed that this is a bug on their side:
The command line integration does not work with the current version of the app. This problem will be fixed with the upcoming update. (At the moment, I cannot tell you an exact release date.)
I'm using google maps to get directions from one place to another. Here is the code
NSString *mapAPIString = [NSString stringWithFormat:#"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",
sourceAddress.coordiate.latitude,
sourceAddress.coordiate.longitude,
destAddress.coordiate.latitude,
destAddress.coordiate.longitude,
];
NSURL *url = [[NSURL alloc] initWithString:mapAPIString];
[[UIApplication sharedApplication] openURL:url];
The code works perfect. But both addresses are marked as 'Unknown address' in iOS Map App. Is it possible to add custom title for each address ?
iOS 6 is still under NDA, but if you have access to the docs have a look at them and you will probably find useful information for this problem.