#pragma mark 判断是否打开定位
+(BOOL)determineWhetherTheAPPOpensTheLocation{
if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusAuthorizedWhenInUse || [CLLocationManager authorizationStatus] ==kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] ==kCLAuthorizationStatusAuthorizedAlways)) {
return YES;
}else if ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusDenied) {
return NO;
}else{
return NO;
}
}
if (![LocationTool determineWhetherTheAPPOpensTheLocation]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"定位服务已关闭"message:@"请到设置->隐私->定位服务中开启【玩票】定位服务,以便于准确获得你的周边电影信息" delegate:self cancelButtonTitle:nil otherButtonTitles:@"设置",@"好",nil];
alert.tag = 2;
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
}