UIAlertView 就像“打开定位服务以允许地图确定您的位置”。设置 +取消
我想发出此警报:
Turn On Location Services to allow maps to determine your location
我需要“设置”和“取消”,就像“地图”应用程序一样。
“设置”应该打开设置->常规->位置服务
我没有找到打开设置页面的方法。
你能帮助我吗?
谢谢
I Want to emit this alert:
Turn On Location Services to allow maps to determine your location
I need both "Settings" and "Cancel" exactly like the "maps" application.
"Settings" should open settings->general->location services
I didn't find the way to open the settings page.
Can you help me?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
创建警报非常简单,它只是一个(假)模态 UIView。
但是,不可能以编程方式打开“设置”应用,至少在不使用私有方法的情况下会阻止您的应用获得 App Store 批准。
Creating the alert is pretty straightforward, it's just a (faux-)modal UIView.
However, it's not possible to open the Settings app programmatically, at least not without using private methods that will prevent your app from being approved for the App Store.
这是你自己不可能完成的。但是,如果您的应用程序需要访问位置服务,操作系统将为您显示一个类似的对话框,如下所示。
编辑:布兰特在下面提到“可以通过在 CLLocationManager 上设置目的属性的值来自定义消息。”
This is not possible to accomplish on your own. However, if your application needs to access location services the OS will present a dialog like this for you as seen below.
Edit: Brant mentioned below that "the message can be customized by setting the value of the purpose property on your CLLocationManager."
您无法打开“常规”、“位置”等特定设置页面,但可以在 iOS 8 中打开设置页面。
You can't open specific settings page like General, Locatios etc., but you can open settings page in iOS 8.
斯威夫特2.0版本:
Swift 2.0 version:
目前无法以编程方式打开设置窗格。请参阅此处。
It's not possible to open the setting pane programmatically at this moment. Refer to here.
这不是你添加的东西。当应用程序想要使用位置服务但它在设置中关闭时,该屏幕就会出现。
推送通知也会发生同样的情况。
It's not something you add. That screen comes up when the applications wants to use locational services but it's turned off in the settings.
The same thing happens with push notifications.
换句话说,如果您希望应用程序出现在 App Store 上,则无法以编程方式打开“设置”应用程序。
如果您的应用程序支持并使用定位服务等确定的功能,则此弹出窗口会在您的应用程序启动时自动“生成”。
您可以在参考库中找到有关此服务的更多信息:https ://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=CoreLocation
How other said, you can't open Settings app programmatically if you want your app on the App Store.
This popup is automatically "generated" at launch of your app if it support and uses a determined functions like Location Service.
You can find more informations about this service on the Reference Library: https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=CoreLocation