Sygic URL方案 - 应用程序无法打开

Gui*_*rme 1 url-scheme openurl ios sygic

我正在尝试将最受欢迎的导航应用程序集成到我的应用程序中,除了Sygic之外,我选择的所有工作都是如此.

按照本指南,我编写了代码:

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

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL]];
Run Code Online (Sandbox Code Playgroud)

但是当代码运行时,Sygic没有打开,没有任何反应.

在安装应用程序时以及不应用程序时检查[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.sygic.aura://"]]返回(应该如此).YESNO

我使用"Sygic Brasil"和"Sygic(All Regions)"进行了测试,版本13,但都没有打开.我也尝试过百分比转义URL字符串,但这也无效.

2in*_*tor 6

你尝试下面的代码,

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");
}
Run Code Online (Sandbox Code Playgroud)