- Erreur [CLLocationManager requestWhenInUseAuthorization] ou - [CLLocationManager requestAlwaysAuthorization]

C'est mon code, en montrant à la fois l'alerte et le point bleu pour la position actuelle sur la carte:

MapName.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>


@interface MapName : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate>

@property (strong, nonatomic) IBOutlet MKMapView *MapName;
@property (strong, nonatomic) CLLocationManager *locationManager;

@end

MapName.m

- (void)viewDidLoad
{
[super viewDidLoad];

self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
    [self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];

//Center the map
[self gotoLocation];

//Show current position
_MapName.showsUserLocation = YES;

}

J'ai ajouté la clé NSLocationWhenIsUseUsageDescription comme une chaîne de caractères pour l'Info.plist.
Je suis toujours le même message d'erreur sur Xcode.

source d'informationauteur Max1980