IOS uses system targeting to get current latitude and longitude and geographic information

Source: Internet
Author: User

These days, when you do an iOS project, you need to navigate to get the name of the current city. Baidu Map SDK has this function, but in order to not rely on third parties, here use iOS comes with frame corelocation to achieve this requirement. After iOS8 out, for positioning needs a little more processing, can be normal positioning.

Aside from this: Many social, e-commerce, group buying applications have introduced maps and positioning functions, and map functionality is no longer unique to map applications and navigation applications. With maps and positioning, it really makes our lives more colorful and dramatically changes our way of life. For example, you go to a strange place to find nearby hotels, supermarkets and so on can open the software search surrounding; Similarly, there are a lot of group buying software can automatically recommend certain items to you based on your location ( of course, for businesses, these services are definitely not free, This is also the map-type software profit point is located ) [ system, Baidu, German ];

  

IOS 8 Targeting:

    • Add in Info.plist :

Allow GPS description for use in foreground

Nslocationalwaysusagedescription=yes

Description of allow permanent use of GPs

Nslocationwheninuseusagedescription=yes

next comes the related code

 The following are the printing results:

In addition, the location of the service is best to run on the real machine, the location of the simulator a bit pit, need to make some relevant settings

IOS uses system targeting to get current latitude and longitude and geographic information

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.