URL Scheme “Open Settings” ios

旧城冷巷雨未停 提交于 2019-11-27 19:07:11
BalestraPatrick

As of iOS 8, it's possible to launch the Settings app that directly opens your Privacy app section in this way:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

In Swift:

if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
    UIApplication.sharedApplication().openURL(settingsURL)
}

In Swift 3.0:

if let settingsURL = URL(string: UIApplicationOpenSettingsURLString + Bundle.main.bundleIdentifier!) {
    UIApplication.shared.openURL(settingsURL as URL)
}
Pablo

1.- Add URL Types

2.- Use:

Objective - C

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];

Swift

 UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=General")!)

3.- Other path find in this answer: iOS Launching Settings -> Restrictions URL Scheme

chawki

This is not possible anymore in iOS 11, we can just open Settings. Here a Swift 4 code snippet:

if let url = URL(string:UIApplicationOpenSettingsURLString) {
   if UIApplication.shared.canOpenURL(url) {
     UIApplication.shared.open(url, options: [:], completionHandler: nil)
   }
}
pawel_d

Alerts on your screenshots are system alerts. The first occurs when app wants to use internet and have a blocked cellular data for application (and Wifi is not connected). The second occurs when an application wants to use location services, and you have turned off wifi. It is not possible control the display of these alerts.

In iOS 8 (Xcode 6) is the ability to open the settings directly from the application. Please read this topics: How to open Settings programmatically like in Facebook app?

Opening the Settings app from another app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!