Opening the Settings app from another app

前端 未结 17 2198
傲寒
傲寒 2020-11-22 01:37

Okay, I know that there are many question about it, but they are all from many time ago.

So. I know that it is possible because the Map app does it.

In the M

17条回答
  •  感情败类
    2020-11-22 01:58

    In Swift 3 all I needed is this (here for example redirect to my app notifications):

    if let url = URL(string: "App-Prefs:root=NOTIFICATIONS_ID&path=your app bundleID") {
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(url, completionHandler: .none)
        } else {
            // Fallback on earlier versions
        }
    }
    

    Source: phynet gist.

    This worked with me only when settings is in background. It will redirect you to your app notification settings but if settings wasn't running in the background it will just redirect you to notification settings in general.

提交回复
热议问题