5
似乎Apple已經將很多應用程序配置移至iOS 11的應用程序路徑,如何在設置中以編程方式打開應用程序路徑?我試過"App-Prefs:root=\(Bundle.main.bundleIdentifier!)"
,但這似乎不起作用。如何在設置中打開您的應用程序iOS 11
請注意,我的問題是具體到:如何打開設置應用程序路徑:不如何打開設置
似乎Apple已經將很多應用程序配置移至iOS 11的應用程序路徑,如何在設置中以編程方式打開應用程序路徑?我試過"App-Prefs:root=\(Bundle.main.bundleIdentifier!)"
,但這似乎不起作用。如何在設置中打開您的應用程序iOS 11
請注意,我的問題是具體到:如何打開設置應用程序路徑:不如何打開設置
這裏是你要尋找的代碼,我想:
if let url = URL(string:UIApplicationOpenSettingsURLString) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
openURL
,因爲iOS的10已被棄用,所以我會建議你使用:
if let url = URL(string:UIApplicationOpenSettingsURLString) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: { success in
log.debug("Open app settings success: \(success)")
})
}
}