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.