【问题标题】:custom URL scheme doesn't work! Navigon AppInteract自定义 URL 方案不起作用!导航应用交互
【发布时间】:2011-02-17 04:20:29
【问题描述】:

这真的让我很沮丧。我使用了 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]];

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

非常感谢!

【问题讨论】:

  • 没有人吗?请给我一个提示:)

标签: iphone url-scheme


【解决方案1】:

我终于找到了正确的解决方案。 Navigon 应用程序交换纬度和经度值的秘密成分。

使用这个自定义 url 方案来传递导航目的地坐标(传递的坐标必须在加载的地图上): navigon://coordinate/YourAppName/longitude/latitude

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

【讨论】:

【解决方案2】:

嗯,它应该工作。这是我的代码: 唯一的区别是,如果安装了 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 ?

【讨论】:

    【解决方案3】:

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

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

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

    信息:我昨天打电话给navigon支持,接电话的女人很无助而且非常咄咄逼人,我现在正在考虑使用TomTom :)

    【讨论】:

    • 自从你打电话给 navigon 支持已经两年了,但你猜怎么着:当我打电话时,那个粗鲁的女人还在那儿 ;-) 只是想知道他们怎么能让这样的混蛋在第一线支持工作导航!?
    猜你喜欢
    • 2021-01-09
    • 1970-01-01
    • 2023-03-12
    • 2012-09-19
    • 2017-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多