自定义URL方案不起作用! Navigon AppInteract

时间:2010-05-08 14:56:42

标签: iphone url-scheme

这真让我很沮丧。我使用了Navigon本身提供的文档。不幸的是,它没有按预期工作。 Navigon启动,但在主菜单停止。

我所做的就是:

NSString *myTestStr = [NSString stringWithFormat:@"navigon://App|Another place|FRA|75008|PARIS|rue de Turin|17|2.324621|48.881273"];

   NSString *navigonStrEsc = [myTestStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
   NSLog(@"navigonStr: %@", navigonStrEsc);
   [[UIApplication sharedApplication] openURL:[NSURL URLWithString:navigonStrEsc]];

任何想法我的方式有什么问题?

非常感谢!

3 个答案:

答案 0 :(得分:3)

最后,我找到了正确的解决方案。 Navigon应用程序的秘密成分互换了纬度和经度值。

使用此自定义网址方案传递导航目标坐标(传递的坐标必须位于已加载的地图上): NAVIGON://坐标/ YourAppName /经度/纬度

例如:navigon://coordinate/NaviCard/19.084443/47.573305

答案 1 :(得分:0)

哼它应该有效。这是我的代码: 唯一不同的是,如果安装了FRA,我的方案会改变,那么首选navigonFRA。

NSString* scheme = @"navigonFRA";
if ((![NavigonApplication isFRInstalled]) && [NavigonApplication isWorldInstalled])
    scheme = @"navigon";

NSString* urlAsString = nil;
urlAsString = [NSString stringWithFormat:@"%@://%@|%@|%@|%@|%@|%@|%@|%f|%f",
               scheme,
               @"myApp",            // Field1/AppName:Application or Company Name (e.g. AroundMe) 
               thePOI.name,         // Field2/NameOfPOI: Name of POI (e.g. Navigon AG Würzburg) 
               @"FRA",                  // Field3/Country: ISO 3166-1 alpha-3 code for country (http://unstats.un.org/unsd/methods/m49/m49alpha.htm) (e.g. DEU) 
               @"",                     // Field4/ZipCode: Postalcode, ZIP code of the POIs city (e.g. 97080) 
               thePOI.location.city,    // Field5/City: Name of POIs city (e.g. Würzburg) 
               thePOI.location.streetAddress,   // Field6/Street:POIs street name (e.g. Berliner Platz) 
               @"",                             // Field7/HouseNumber: POIs street/house number (e.g. 11) 
               thePOI.location.longitude,       // Field8/Longitude: Longitude in WGS84 (e.g. 9.870) 
               thePOI.location.latitude];       // Field9/Latitude: Latitude in WGS84 (e.g. 49.938) 

urlAsString = [urlAsString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"Starting Navigon app with %@", urlAsString);
NSURL*url = [[NSURL alloc] initWithString:urlAsString];
[[UIApplication sharedApplication ]openURL:url];
[url release];

此代码正常运行。您是否检查过您的导航版本是> = v1.5?

答案 2 :(得分:0)

我发现了问题,第一个字段(AppName)非常重要。

现在可以使用以下html链接:

<a href="navigon://Safari|Some nice place||||||9.937156|49.800074">Some nice place</a>

对于信息:我昨天打电话给导航员的支持,那个回答的女人很无助而且非常咄咄逼人,我现在正在考虑使用TomTom:)

相关问题