CLLocationManager locationServicesEnabled 事件发生变化

Dmi*_*riy 3 ios

[CLLocationManager locationServicesEnabled]更改时如何监控?我需要类似delegate或的东西notification

Bhu*_*tre 5

使用 CLLocationManager 的 delagte 方法

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
Run Code Online (Sandbox Code Playgroud)

这些是文档中的 CLAuthorizationStatus 描述:

    > typedef enum {
    >     kCLAuthorizationStatusNotDetermined = 0, // User has not yet made a choice with regards to this application
    >     kCLAuthorizationStatusRestricted,        // This application is not authorized to use location services.  Due
    >                                              // to active restrictions on location services, the user cannot change
    >                                              // this status, and may not have personally denied authorization
    >     kCLAuthorizationStatusDenied,            // User has explicitly denied authorization for this application, or
    >                                              // location services are disabled in Settings
    >     kCLAuthorizationStatusAuthorized         // User has authorized this application to use location services 
} CLAuthorizationStatus;
Run Code Online (Sandbox Code Playgroud)