Baidu map navigation for iOS development and ios map navigation

Source: Internet
Author: User

Baidu map navigation for iOS development and ios map navigation

This article describes the navigation functions of Baidu map:

Step 1: Before using Baidu navigation, We need to download the navigation SDK on the Baidu map open platform, which is 85.8 MB in total. students with poor network speed can prepare them in advance.

Step 2: introduce the system package required for navigation

Set AudioToolbox. framework, ImageIO. framework, CoreMotion. framework, CoreLocation. framework, CoreTelephony. framework, MediaPlayer. framework, AVFoundation. framework, SystemConfiguration. framework and libstdc ++ 6.0.9.dylib are added to the project.

Step 3: Set the TouchJSON library to a non-ARC compilation option, that is, set the compilation method in Compile Sources to-fno-objc-arc.

Step 4: Select media and then locate the background Mode

Step 5: add the header file and initiate navigation

# Import "BNCoreServices. h "// introduce the map navigation header file # pragma mark-pilot initiate navigation-(void) startNavi {// node array NSMutableArray * nodesArray = [[NSMutableArray alloc] initWithCapacity: 2]; // start point BNRoutePlanNode * 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]; // end point: BNRoutePlanNode * endNode = [[BNRoutePlanNode alloc] init]; endNode. pos = [[BNPosition alloc] init]; endNode. pos. x = 114.077075; endNode. pos. y = 22.543634; endNode. pos. eType = role; [nodesArray addObject: endNode]; // initiate a path planning [BNCoreServices_RoutePlan startNaviRoutePlan: inclunavinodes: nodesArray time: nil delegete: self userInfo: nil];} # pragma mark-BNNaviUIManagerDelegate success callback-(void) routePlanDidFinished :( NSDictionary *) userInfo {NSLog (@ ""); // Path Planning successful, start navigation BN_NaviTypeSimulator default simulated navigation, BN_NaviTypeReal real machine navigation [BNCoreServices_UI showNaviUI: BN_NaviTypeSimulator delegete: self isNeedLandscape: YES];}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.