custom URL scheme doesn't work! Navigon AppInteract
It is really frustrating me. I used the doc provide开发者_如何学编程d by Navigon itself. Unfortunately it doesn't work as expected. Navigon launches, but stops at the main menu.
All I do is this:
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]];
Any ideas what is wrong with my way?
thanks a lot!
Finally I figured out the right solution. The secret ingredients that the Navigon app interchanged the latitude and longitude values.
Use this custom url scheme to pass the navigation destination coordinates (the passed coordinates have to be on the loaded map): navigon://coordinate/YourAppName/longitude/latitude
For example: navigon://coordinate/NaviCard/19.084443/47.573305
hum it should work. Here's my code: The only diff is that my scheme changes if FRA is installed , then navigonFRA is prefered.
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];
And this code is working. Did you check that your navigon version is >= v1.5 ?
I found the problem, the first field (AppName) is pretty important.
The following html link now works :
<a href="navigon://Safari|Some nice place||||||9.937156|49.800074">Some nice place</a>
For informations : I called the navigon support yesterday, the woman who answered was helpless and terribly aggressive, I'm thinking about using TomTom now :)
精彩评论