I am creating an app that runs on Mac using objective-c. Since location information permission is required, I implemented the following.
// AppDelegate.m
#import <CoreLocation/CoreLocation.h>
- (void)getLocation {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager requestWhenInUseAuthorization];
}
- (IBAction)buttonClicked:(id)sender{
[self getLocation];
}
Info.plist
<key>NSLocationUsageDescription</key>
<string>This app requires location information.</string>
What I'm hoping for is that when I run this app and press the button, I'd like to see an OS alert asking for permission to use location information, saying "***" would like to use your current location.
However, when I try it, no alert is displayed. However, the app name has been added to the "Location Services" item in "Security & Privacy" in System Preferences.
How can I display alerts?