Notes for Using iOS Baidu Map

Source: Internet
Author: User

Notes for Using iOS Baidu Map

Step 1: Introduce BaiduMapAPI. framework

Step 2 introduce the required system library

CoreLocation. framework, QuartzCore. framework, OpenGLES. framework, SystemConfiguration. framework, CoreGraphics. framework, and Security. framework are introduced in the Xcode project. Add the frameworks in Xcode Project> Active Target> Build Phases> Link Binary With Libraries.

Step 3: configure the environment

Add-ObjC to TARGETS-> Build Settings-> Other Linker Flags.

Step 4: Introduce the mapapi. bundle resource file

 

If you use the basic map function, you need to add the resource. Otherwise, the map cannot be displayed normally.

Mapapi. bundle stores resource images for locating, marking View and route key points by default, and also stores necessary resource files for vector map rendering. If you do not need the built-in image display function, you can delete the image folder in the bundle file. You can also replace or delete the image files in the image folder of the bundle as needed.

Method: select the project name, right-click the project name, and choose Add Files to "project name "..., Select the mapapi. bundle file from the BaiduMapAPI. framework | Resources file, select the Copy items if needed check box, and click the Add button to Add the resource file to the project.

 

Step 5 introduce the header file

 

Introduce the header file in the SDK class:

# Import
 
  
// Introduce all header files # import
  
   
// Only introduce a single header file.
  
 
The content in the Baidu map document is referenced above. Note the fourth article, which exists in the. framework, but must be added to the project separately.

 

You also need to add it in info. plist (either of the following two is selected, and NSLocationWhenInUseUsageDescription is used by default ):

NSLocationWhenInUseUsageDescription, which allows you to obtain the GPS description during foreground use.

NSLocationAlwaysUsageDescription, which allows permanent use of GPS description

 

The engine initialization fails due to the absence of step 1 during use. It is inconvenient to write Baidu documents. I wrote this article to help my friends who will use Baidu map.

 

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.