URL Scheme “Open Settings” ios

后端 未结 5 1913
后悔当初
后悔当初 2020-12-05 03:05

I know this question has been asked so many times. The answers say that this is not available in Xcode > 5.x. but I saw some apps that can use this(Go to Settings)(iOS7). Is

5条回答
  •  一整个雨季
    2020-12-05 03:16

    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)
    }
    

提交回复
热议问题