How to open Location services screen from setting screen?

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

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

11条回答
  •  攒了一身酷
    2020-12-04 14:50

    After adding prefs as a url type, use the following code to go directly to the location settings of an application.

    if let url = URL(string: "App-prefs:root=LOCATION_SERVICES") {
         UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
    

提交回复
热议问题