我正在尝试将最流行的导航应用程序集成到我的应用程序中,除了Sygic之外,我选择了所有这些应用程序。
在本指南之后,我编写了代码:
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字符串,但这也不起作用。
发布于 2013-12-26 12:42:30
你试着遵循代码,
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");
}https://stackoverflow.com/questions/20784681
复制相似问题