IOS: positioning service and map application development, ios Application Development

Source: Internet
Author: User

IOS: positioning service and map application development, ios Application Development
1. Locate the service.

IOS devices provide three different positioning methods:

1. WiFi positioning: query the geographic location information of a Wi-Fi router to save power. iPhone, Ipod touch, and iPad can both be used.

2. Positioning of cellular mobile phone base stations. Only iPhone and 3G iPod touch and iPad can be used through mobile operator base stations.

3. GPS satellite positioning through 3 ~ The positioning of the Four GPS satellites is the most accurate, but the power consumption is high and cannot be blocked. The iPhone, iPod touch, and iPad can both be used.

Unlike the android system, iOS does not specify which method can be used to locate Service programming. The iOS API shields the underlying details. developers and users do not know which method the device uses to locate the problem. The iOS system will locate the problem based on the device situation and the surrounding environment, the best solution is adopted. This solution is as follows: if GPS information can be received, GPS positioning is preferred for devices; otherwise, WiFi or cellular base station positioning is preferred, and WiFi is preferred between Wi-Fi and cellular base stations, if you cannot connect to WiFi, use the cell Base Station to locate the problem.

In general, the advantage of GPS positioning is accuracy and wide coverage, but the disadvantage is that it cannot be blocked (for example, GPS satellite signals cannot be received in buildings). After GPS is enabled, it will be less expensive. The cellular base station not only has a large error, but also consumes the user traffic fee. WiFi positioning should be the most economical.

2. Positioning Service Programming

1. The higher the precision, the higher the request frequency for obtaining the location information, which means the more power consumption the device consumes.

2. The call method startUpdatingLocation will be enabled, and it will continuously request the callback of new location information based on the set conditions. Therefore, you must be cautious when enabling this method. To enable this method at the most appropriate time, viewWillAppear: is the most suitable method in the View Controller's declarative cycle method. The stop service method is stopUpdatingLocation, which is called in viewWillAppear of the View Controller. The Code is as follows:

-(Void) viewWillDisappear :( BOOL) animated

{

[Super viewWillDisappear: animated];

// Stop Positioning

[_ LocationManager stopUpdatingLocation];

}

Iii. Anti-encoding of geographic information

Landmark attributes:

1. addressDictionary: Address information dictionary, which contains key-value pairs. The keys are defined in the Address Book framework.

2, ISOcountryCode, ISO country code;

3. country information.

4. postalCode and zip code.

5. administrativeArea: Administrative Region information.

6. subAdministrativeArea: additional administrative area information.

7. locality: Specifies the city information.

8. subLocality: specify additional information about the city.

9. thoroughfare: Specifies the street level information.

10. subThoroughfare: Specifies the street level additional information.

4. Test the positioning service.

There are two options for testing and running the positioning service application: simulator and device. In principle, you must first pass the simulator and then use the device for testing. Due to the special nature of the positioning service, we need to take the equipment to the site for testing, so sometimes there are limitations, it is impossible for us to test whether there is a restaurant called "Southland" in Hong Kong to go to Hong Kong. Therefore, simulator testing is sometimes irreplaceable.

Generally, the GPX tool through www.mygeoposition.com is used. This is a free website that provides services such as geographic information encoding and anti-encoding to generate KML and GPX files.

5. Use the iOS6 Apple map.

After iOS6, Google Maps are no longer used, but apple maps are used. However, the API encoding interface does not change much, so developers do not need to learn new things to develop maps. This is a responsible practice.

IOS applications use MapKit APIs to develop map applications. Its core is the MKMapView class.

6. Use the map outside the program.

Maps outside the app calling program have two options: iOS6 Apple map and Google Web Map.

7. Call Google's Web Map API to develop map applications. However, all technologies involved here are Web technologies, not local technologies.

8. Use a localized Baidu map.

1. Baidu maps are written in C ++. We need to change a *. m file in our project to *. mm. *. Mm indicates that this file is an Object-C ++ code file, that is, the Code module can contain C ++ code.

2. Note that the apple iOS SDK provides the CLGeocoder class, which can also be used to encode and decomcode geographic information. However, if the map you use is a Baidu map, in terms of geographic information encoding and anti-encoding, it is best to use the API provided by 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.