How to open Location services screen from setting screen?

前端 未结 11 2098
别那么骄傲
别那么骄傲 2020-12-04 14:01

I want to open location service screen programmatically to turn on service.

11条回答
  •  不思量自难忘°
    2020-12-04 15:03

    SWIFT 4 tested:

    Only way to avoid getting rejected and open Location Preferences of own app is:

    if let bundleId = Bundle.main.bundleIdentifier,
       let url = URL(string: "\(UIApplication.openSettingsURLString)&path=LOCATION/\(bundleId)") {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
    

提交回复
热议问题