How to handle “Don't Allow” for location manager?

前端 未结 1 494
遇见更好的自我
遇见更好的自我 2020-12-13 21:18

I haven\'t think of this yet now .

Till now whenever device was asking me use location update I was allowing it .

But when now I am not allowing then it th

相关标签:
1条回答
  • 2020-12-13 22:02

    Implement - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error.

    - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
        NSMutableString *errorString = [[[NSMutableString alloc] init] autorelease];
    
        if ([error domain] == kCLErrorDomain) {
    
            // We handle CoreLocation-related errors here
        switch ([error code]) {
            // "Don't Allow" on two successive app launches is the same as saying "never allow". The user
            // can reset this for all apps by going to Settings > General > Reset > Reset Location Warnings.
            case kCLErrorDenied:
                //...
                break;
            case kCLErrorLocationUnknown:
                //...
                break;
            default:
                //...
                break;
            }
        } else {
            // We handle all non-CoreLocation errors here
        }
    }
    
    0 讨论(0)
提交回复
热议问题