我们可以通过不关闭应用程序并转到设置页面来调用位置服务警报以重新弹出:类似于某些用户不知道在弹出窗口时是否必须选择“允许或不允许”。问题的解决方案。位置服务警报
Q
位置服务警报
1
A
回答
4
如果您的要求是提醒用户他的位置服务状态,您可以提供自己的警报,并可以导航到用户设置页面。
- (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"]];
}
}
+0
谢谢!这可能是我的解决方案 – user1531399
0
相关问题
- 1. 位置服务iOS警报回调
- 2. Android - 位置报警
- 3. Android报警服务
- 4. 在所有视图之上显示位置服务警报
- 5. 如何处理“取消”按钮弹出警报位置服务
- 6. 基于位置的服务中的报警系统
- 7. 保存在服务器上的位置的接近警报
- 8. 位置服务发送Android的天气警报通知
- 9. 核心位置的警报
- 10. Appium 1.6 Android。 :位置警报
- 11. 报警服务作为后台服务
- 12. 角度2警报服务
- 13. 从服务呼叫警报
- 14. 即时警报服务警报级别规范
- 15. 与服务警报对话框警报管理
- 16. iOS:为什么启动时会显示两次“打开位置服务”警报?
- 17. 存储在服务器中的位置坐标的接近警报
- 18. 如何保持位置服务请求警报框保持出现
- 19. 如何在地理位置服务被拒绝时添加警报?
- 20. 当前位置警报访问
- 21. 警报查看位置不是中心
- 22. 警报不会显示位置
- 23. Extjs:警报消息框位置
- 24. jQuery警报箱固定位置问题?
- 25. 位置许可警报按钮回拨
- 26. Javascript timed弹出警报与位置.href
- 27. 在android中启动报警服务
- 28. 给定时间的报警服务
- 29. Grafana警报不与Hawkular服务合作
- 30. 周期性工作报警或服务
你到底在问什么?如果您尝试将用户路由到设置页面以修改其位置访问权限,则不能再执行此操作。看到这个问题:http://stackoverflow.com/questions/9627451/how-to-open-preferences-settings-with-ios-5-1 – johngraham