gpt4 book ai didi

ios - 位置服务警报

转载 作者:行者123 更新时间:2023-12-01 18:27:09 25 4
gpt4 key购买 nike

我们可以通过不关闭应用程序并转到设置页面来再次调用位置服务警报吗?就像有些用户不知道一旦弹出窗口便是否必须选择“允许或不允许”。问题的任何解决方案。

最佳答案

如果您的要求是要提醒用户有关其位置服务状态的信息,则可以提供有关它的警报,并可以将用户导航到“设置”页面。

      - (void) showLocationAlert {

if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) {

//Check whether Settings page is openable (iOS 5.1 not allows Settings page to be opened via openURL:)
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service,Turn on location service to allow \"YourApp\" to determine your location" delegate:self cancelButtonTitle:@"Settings" otherButtonTitles:@"Cancel", nil];
[alert show];

}
else {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alert show];
}
}
}



- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]];
}

}

关于ios - 位置服务警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12398688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com