Prompt message when custom location is accessed in IOS

Source: Internet
Author: User

In iOS, you must pass the user's consent to access the user's location (cllocationmanager). This process is controlled by the system and automatically asks the user at the first request, if you can show users the reason for using coordinates, rather than malicious access, the user experience will be much better.

Cllocationmanager has a purpose attribute, through which you can add your own information in the request. This attribute has been available since IOS 3.2.

 
Cllocationmanager * _ locmanager =[[Cllocationmanager alloc] init]; _ locmanager.Delegate=Self; _ locmanager. Purpose=@"Please allow access to your location. Otherwise, you cannot do it."; [_ Locmanager startupdatinglocation];

However, the property of purpose has been deprecated in IOS 6.0. A better way is to add the nslocationusagedescription key to info. plist. In xcode, the"Privacy-location usage description". This value will be read in iOS 6 without adding purpose.

Similarly, nscalendarsusagedescription is used to access the calendar, nscontactsusagedescription is used to access the contacts, nsphotolibraryusagedescription is used to access the album, and nsremindersusagedescription is used to access the reminder.

 

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.