您的位置:首页 > 移动开发 > IOS开发

ios 定位是否可用的判断

2016-01-15 14:52 483 查看
- (void)locationManager: (CLLocationManager *)manager didFailWithError: (NSError *)error {

    

    NSString *errorString;

    [manager stopUpdatingLocation];

    NSLog(@"Error: %@",[error localizedDescription]);

    switch([error code]) {

        case kCLErrorDenied:

            //Access denied by user

            errorString = @"用户不让访问";

            //Do something...

            break;

        case kCLErrorLocationUnknown:

            //Probably temporary...

            errorString = @"定位关闭";

            //Do something else...

            break;

        default:

            errorString = @"获取不到位置信息,网络不稳定等";

            break;

    }

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];

    [alert show];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: