[OBJC]View Plaincopy
1.
BOOLHasbaidumap =
NO;
2.
BOOLHasgaodemap =
NO;
3.
4.
if([[[UIApplication Sharedapplication]canopenurl:[nsurl urlwithstring:@ "baidumap://map/"]]) {
5. Hasbaidumap =
YES;
6.}
7.
if([[[UIApplication Sharedapplication]canopenurl:[nsurl urlwithstring:@ "iosamap://"]]) {
8. Hasgaodemap =
YES;
9.}
10.
11.
12.
if([@ "Use Baidu Map Navigation" Isequaltostring:title])
13. {
14.
NSString*urlstring = [[NSString stringwithformat:@] Baidumap://map/direction?origin=latlng:%f,%f|name: My location &destination =latlng:%f,%f|name: End &mode=driving ", Currentlat, Currentlon,_shoplat,_shoplon] Stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];
15.
[[[UIApplication Sharedapplication]openurl:[nsurl urlwithstring:urlstring]];
17.}
18.
Else
if([@ "Using the Isequaltostring:title Map Navigation"])
19. {
20.
NSString*urlstring = [[NSString stringwithformat:@] iosamap://navi?sourceapplication=%@&backscheme=%@&poiname=%@ &lat=%f&lon=%f&dev=1&style=2 ", @" app name ", Yourscheme, @" End ", _shoplat, _shoplon] Stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];
21st.
[[UIApplication Sharedapplication]openurl:[nsurl urlwithstring:urlstring]]; 23.}
iOS to judge and use the Baidu map of the German map navigation (using URIs, not integrated SDK)