IOS development based on Baidu map (5)-Summary of core issues

Source: Internet
Author: User
Tags map class

Currently, the SKD version for iOS is 1.2.1. Here we will mainly discuss some issues with this version and development considerations.

1. bmkmapview is a Baidu map class. When multiple bmkmapview objects are created, these objects share some data (not carefully studying which data is shared). Therefore, the following problems occur:

A. When you use a gesture to zoom in, zoom out, or move a bmkmapview, other bmkmapview objects are automatically zoomed in, out, and moved.

B. Start the applicationProgramFirst, the displayed bmkmapview can get the current user location. Other bmkmapview may have to wait for a while or cannot get the current user location.

2. To solve the problem in 1. B, you can use only one bmkmapview object. For example, you can share the same bmkmapview object in two different uiviews. In addition, there is a way to basically solve the issue of 1.a. Assume that both uiview A and uiview B have bmkmapview (which can be different or the same object). When switching between uiview A and uiview B, record the frame of the current bmkmapview, then, you can set the frame to restore the status before switching. The disadvantage of this method is that when switching quickly, viewdidappear may not be called, and the call sequence of viewwilldisapper is uncertain, but it can meet the requirements of common operations.

3. bmksearch provides search, address resolution, and other functions. Baidu uses callback to respond to search results. The key issue is that sometimes callback is not called (I personally feel that Baidu's SDK cannot find the callback function correctly after bmksearch, for example, in different threads ). In order to allow Baidu SDK to correctly locate the callback, we suggest the following:

A. Do not release the bmksearch object before obtaining the callback. It is best to make it a global object. (Required)

B. When searching for a route, if the start position is expressed by the longitude and latitude, you must set the name information (not a Null String) in the node information except for the PT information of the longitude and latitude ). (Required)

C. You cannot perform multiple searches at the same time. (Required)

D. Before each search through the bmksearch object, it is best to set its delegate to nil, perform release, then alloc, and then perform the search. (Strongly recommended)

E. all search operations should not be initiated by delegation or callback from other threads. This object should be actively initiated and used as a search proxy, in this way, the Baidu SDK can find the callback function correctly. (Strongly recommended)

4. sometimes it is necessary to determine whether the current user's latitude and longitude are in China. You can use the callback after bmksearch's address anti-resolution. If the returned error code is bmkerrorresultnotfound, it may not be in China, this error code may be returned for other reasons.

5. In fact, the best solution is to use the autonavi amap api. If it is ios6, you can directly use mkmapview, which uses the autonavi interface. At present, the autonavi interface lacks a walking route. It is said that it is still under development and I believe it will be supported in the future.

[Not reproduced without the permission of the author]

Http://blog.csdn.net/donhao/article/details/7823843

IOS development based on Baidu map (1) -- current user location

IOS development based on Baidu map (2) -- getting poi

IOS development based on Baidu map (3) -- address search

IOS development based on Baidu map (4) -- path search

IOS development based on Baidu map (5)-Summary of core issues

IOS development based on Baidu map (6) -- Google coordinates to hundreds of coordinates

IOS development based on Baidu map (7) -- convert Baidu coordinates to Google coordinates

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.