/**
* 判斷定位是否開啟
*/
if([CLLocationManager locationServicesEnabled] && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied)
{
NSLog(@"沒打開");
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"溫馨提示" message:@"為了更好的體驗,請到設(shè)置->隱私->定位服務(wù)中開啟!【陪你APP】定位服務(wù),已便獲取附近信息!" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];
[alertView show];
}
else
{
NSLog(@"打開");
}
#pragma mark-UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1)
{
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
[[UIApplication sharedApplication] openURL:url];
}
}
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者