Simple use of Baidu Map SDK

Source: Internet
Author: User

To use the Baidu Map SDK must download and configure the project, Baidu official documents in two ways, one is to manually drag and drop the downloaded SDK into the project, and then manually configure the environment, the other is the use of Cocoapods automatic configuration. Today I have tried, personally feel the second method is more convenient, because the manual configuration of the environment is prone to error, all recommend that everyone use Cocoapods. Here are just a few ways to use Cocoapods (the use of cocoapods can be referred to my previous blog post).

First step: create a project using Xcode. Then turn off the project.

Second Step: Open the terminal input CD + project path and enter into the project path; (Enter the CD and then enter a space to drag the created project to the terminal)

Before entering the project path:

After entering the project path:

Step Three: find the Baidu SDK; perform pod search Baidumapkit results in the terminal, note the pod ' Baidumapkit ' in the result content, ' ~> 3.0.0 '

Fourth Step: enter Q In the result of the previous step to exit the current state (bottom cannot be end). Note to IME to be in English state.

Fifth Step: perform vim podfile entry in the terminal

Then enter I into the edit state.

Then enter:

Platform:ios, ' 8.0 '
Target "Map_baidu" do
Pod ' Baidumapkit ', ' ~> 2.10.2 '
End

Note that the second line of the above four lines of code, "Map_baidu", is the project name of the project that was built, and the third line is the contents of the third step.

Then click the ESC key.

Then type : Wq

And then enter.

Sixth step: Perform pod update in the terminal

The display interface of the terminal after the final execution is completed:

The above is the end of the steps to load a third party using Cocoapods, and the following continues to describe the use of the map.

Next, click on the project's ****.xcworkspace to open the project. (There is no error in compiling the project at this time), no longer the configuration environment as stated in the official documentation.

1, enter Baidu Open platform: http://lbsyun.baidu.com/. Enter the appropriate module according to your needs. (Please apply for Baidu account without Baidu account)

2, go to the official document, and then follow the documentation step-by-step operation on the line

The "Introduction" in the "Development Guide" on the left side of the Web page, "Considerations", "Configuration development environment" has been done, only need to apply for "key", you can start from the "base map", according to the actual project needs to add functionality to their own projects. The content in "Hello Baidumap" is for developers to test whether the Baidu Maps SDK is working properly.

The application key is relatively simple, similar to the other three parties:

Fill in as required, where the security code in their own project to find:

Simple use of Baidu Map SDK

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.