Indicate the reason for accessing user location information on Mac OS X

This may be a dumb question, but on iOS we can indicate the reason for accessing the user's location by including the appropriate keys in the NSLocationWhenInUseUsageDescription file ( NSLocationWhenInUseUsageDescription , NSLocationUsageDescription or NSLocationAlwaysUsageDescription ).

However, it seems this cannot be done on a Mac (at least none of them work for me).

Does anyone know how to include this information so that users know for what purpose my application wants to access their location data?

+4
source share
1 answer

The keys are indeed included in CoreLocation.framework and are listed in the Cocoa Keys section. Link to the list of information properties.

NSLocationUsageDescription (iOS 6.0 and later, OS X version 10.9 and later)
Indicates the reason for accessing the location information of users. See the NSLocationUsageDescription for more details.

NSLocationWhenInUseUsageDescription (iOS 8.0 and later, OS X version 10.10 and later)
Indicates the reason for accessing the location information of users. See NSLocationWhenInUseUsageDescription for more information.

NSLocationAlwaysUsageDescription (iOS 8.0 and later, OS X version 10.10 and later)
Indicates the reason for accessing the location information of users. See NSLocationAlwaysUsageDescription for details.

Adding the NSLocationUsageDescription key to Info.plist automatically converted to human-readable (Privacy - Description of the use of location):

enter image description here

enter image description here

When the application starts, I am presented with the above dialog box, which includes a description. It is unclear what exactly you tried, although from basic testing the functionality seems to work.

+2
source

All Articles