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

时间:2013-12-26 12:16:31

标签: ios url-scheme openurl sygic

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

关注this guide,我写了代码:

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

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL]];

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

检查[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.sygic.aura://"]]会在安装应用时返回YES,而NO则不会(应该)。

我使用“Sygic Brasil”和“Sygic(所有地区)”进行了测试,版本13,但都没有打开。 我也尝试过百分比转义URL字符串,但这也不起作用。

1 个答案:

答案 0 :(得分: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");
}
相关问题