检查ipad,iphone的定位功能是否打开

#import <CoreLocation/CoreLocation.h>



if([CLLocationManagerlocationServicesEnabled] && 

        [CLLocationManagerauthorizationStatus] != kCLAuthorizationStatusDenied){

       

            NSLog(@"定位功能已经打开");

            

    }

    else

    {

        UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@"提示" 

                                                        message:@"GPRS定位功能未打开,请在设备的设置里面打开定位功能" 

                                                       delegate:self

                                              cancelButtonTitle:@"了解" 

                                              otherButtonTitles:nil];

        [alert show];

        [alert release];

        

        NSLog(@"定位功能未打开"); 

    }

你可能感兴趣的:(iPhone,import,ipad)