How to use the Baidu Map SDK in iOS development

Source: Internet
Author: User

Baidu Map SDK successfully used for me! The specific steps are now shared as follows: Xcode5.0.2/baidumap_iossdk_v2.4.0_all (Download the latest version, different from before) first register Baidu account, enter the Baidu lbs open platform, select iOS development, enter the page, follow the steps to execute: 1, Apply key, create an app, and an app that corresponds to a key. Apply the name to fill in the name of the app you want to bind, note: Once filled out cannot be changed! Application type Select for mobile; security Code: Open Project, select



Is the content of the bundle identifier; After a successful creation, you will be given a 24-bit key, which will be used later. Then go back to the developer page, follow the development Guide then, first of all, note first, I chose the first way to change the APPDELEGATE.M to appdelegate.mm; the second way, I did not find where to set, and once changed to Objective-c++ In the back to Objective-c compile method, compare trouble; 2nd, 3, 4, 5 It doesn't matter, did not change; next, Hello Baidumap; First import all header files in Baidu Map Inc folder containing all the header files, To make it easier for me to add BMapKit.h to the precompiled file, import the system framework:






  Click the plus sign to add the required library files, and then introduce the Mapapi.bundle file, you can not use, there are some pictures or something; At this point, the compilation should be no problem. Finally, the most critical and error-prone place to import the static library files, Find two downloads from the Baidu SDK. A file, one for the real machine test, one for the simulator, according to the current developer page prompts, I first chose the first way, directly two. A files are dragged into the project, after compiling the link error, I can't find the. A file, there is a i386 error, which makes me headache. Consult a document request aunt, finally did not solve, and this way, even if compiled through, in each run or the real machine test to re-import again, decisively give up treatment; instead, a second way, Use the Lipo command to merge the device and emulator. A into a common. A file, drag and drop the merged generic. A file into the project, open the terminal and enter the downloaded directory with two. A files, execute the command lipo-create release-iphoneos/ LIBBAIDUMAPAPI.A Release-iphonesimulator/libbaidumapapi.a-output LIBBAIDUMAPAPI.A; OK, so the question is: Certainly not the excavator which strong problem, when I execute the line command after a long list of error, in English, is probably said to find my Xcode directory, let me re-set the directory. The original Lipo command was executed to have compiler support to merge two files, and my little Apple did have Xcode installed on it. Why can't he find it? Read the relevant documents and read the specific error, it seems to understand, because my little Apple loaded with two different versions of Xcode, one is Xcode 6.0, in order to easily distinguish the other I named Xcode2 5.0, The default is to open with 6.0, and I use 5.0, he does not know which compiler to execute, so, I decisively to unload the 6.0, re-execute the merge command, this time, the problem again: probably also said that the application did not find the Xcode application, unable to perform the operation, And pop up a box, do you want to install Xcode? I went to the application to see a bit, clearly exist, why say no, looking for a long time did not find a 123来, restart Xcode, restart the simulator, restart the small apple, or not. This really did not recruit, forget to eat, in the restaurant ordered a two-egg ham set meal, see the name should be two eggs plus a ham, Sheng looked at the next is ham scrambled eggs, I asked a weak weak, this is called double egg ham rice? Sheng Fan's sister said, yes, you can also choose two other dishes, you can add a fried egg. I thinkA bit of other dishes, indeed there is a pot of fried eggs! Just understand, the original double egg is this appearance! It seems that you can't just look at the name. This to remind me of that mistake, I can't find my xcode, is it because I renamed him? So I can not find the compiler called Xcode, decisive quick meal back to the Xcode2 5.0 to the standard name: Xcode; execute merge command at times, success! That excited ah, hurriedly will merge the good LIBBAIDUMAPAPI.A file to import the project, Command+b-->build succeeded! According to the developer page of the hint just add code, Command+r ———— > The city of the map so magically appeared in front of me!!

Write these things and hope to be helpful to beginners who have the same problems as me.

How to use the Baidu Map SDK in iOS development

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.