Question

I am trying to integrate the most popular navigation apps into my app, and all of those I chose work, except for Sygic.

Following this guide, I wrote the code:

NSString *URL = [NSString stringWithFormat:@"com.sygic.aura://coordinate|%f|%f|drive",
                                           self.coordinate.longitude,
                                           self.coordinate.latitude];
      
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL]];

But when the code is run, Sygic doesn't open, nothing happens.

Checking [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.sygic.aura://"]] returns YES when the app is installed and NO when it's not (as it should).

I tested using "Sygic Brasil" and "Sygic (All Regions)", version 13, but neither will open. I also tried percent-escaping the URL string, and that didn't work either.

Was it helpful?

Solution

you try following code,

NSString *URL = [NSString stringWithFormat:@"com.sygic.aura://coordinate|%f|%f|drive",
                                       self.coordinate.longitude,
                                       self.coordinate.latitude];

NSURL *newURL = [NSURL URLWithString:[URL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ];

if(newURL)
{
   [[UIApplication sharedApplication] openURL:newURL];
}
else
{
   NSLog(@"Something wrong with lat or long or both");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top