This article mainly tells the Baidu map navigation function:
The first step: Before using Baidu navigation, we need to download the navigation SDK on the open platform of Baidu Map, a total of 85.8M, the students with poor speed can be prepared in advance.
Step two: Introduce the System package required for navigation
Audiotoolbox.framework, Imageio.framework, Coremotion.framework, Corelocation.framework, CoreTelephony.framework, Mediaplayer.framework, Avfoundation.framework, Systemconfiguration.framework, libstdc++6.0.9. Dylib These frameworks are added to the project.
Step three: Set the Touchjson Library to a non-ARC compilation option, that is, set the compilation method in Compile Sources to:-fno-objc-arc
Fourth step: Check the media to locate the background mode
Fifth Step: Add header file, initiate navigation
#import "BNCoreServices.h"//introduction of Map navigation header files#pragmaMark-bnnavirouteplandelegate Initiate Navigation-(void) startnavi{//node ArrayNsmutablearray *nodesarray = [[Nsmutablearray alloc] Initwithcapacity:2]; //starting pointBnrouteplannode *startnode =[[Bnrouteplannode alloc] init]; Startnode.pos=[[Bnposition alloc] init]; Startnode.pos.x=113.936392; Startnode.pos.y=22.547058; StartNode.pos.eType=BNCOORDINATE_BAIDUMAPSDK; [Nodesarray Addobject:startnode]; //EndBnrouteplannode *endnode =[[Bnrouteplannode alloc] init]; Endnode.pos=[[Bnposition alloc] init]; Endnode.pos.x=114.077075; Endnode.pos.y=22.543634; EndNode.pos.eType=BNCOORDINATE_BAIDUMAPSDK; [Nodesarray Addobject:endnode]; //Initiating path Planning[Bncoreservices_routeplan startnavirouteplan:bnrouteplanmode_recommend navinodes:nodesarray time:nil delegete: Self userinfo:nil];}#pragmaMark#pragmaMark-bnnaviuimanagerdelegate Successful Callback-(void) routeplandidfinished: (Nsdictionary *) userinfo{NSLog (@"Road Success"); //Path Planning successful, start navigation bn_navitypesimulator default simulation navigation, Bn_navitypereal real-machine navigation[bncoreservices_ui shownaviui:bn_navitypesimulator delegete:self isneedlandscape:yes];}
iOS Development Baidu Map navigation