17
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UIApplicationOpenSettingsURLStringから設定アプリを開いたときの挙動調査

Last updated at Posted at 2017-03-01

UIApplicationOpenSettingsURLStringから設定アプリを開いたときの挙動を調べました。
(iOS10.2.1で検証)

Swift
@IBAction func openSettingsButtonTapped(_ sender: Any) {
        guard let settingsUrl = URL(string: UIApplicationOpenSettingsURLString) else {
            return
        }
        
        if UIApplication.shared.canOpenURL(settingsUrl) {
            UIApplication.shared.open(settingsUrl)
        }
}

##「設定アプリ」内にアプリ固有の設定項目がない場合

  • 「設定アプリ」を起動済みでない場合、「設定アプリ」のTOP画面に遷移
  • 「設定アプリ」を起動済みの場合、「設定アプリ」内の開いていた画面に遷移

例)

  1. 設定アプリのWiFi設定を開く
  2. UIApplicationOpenSettingsURLStringで遷移
  3. WiFi設定画面が開く

##「設定アプリ」内にアプリ固有の設定項目がある場合
カメラや写真、マイク、位置情報等を利用するアプリやSettings.bundleでアプリ固有の設定項目(プリファレンス)を作成したアプリの場合

  • 「設定アプリ」の起動有無に関わらず、アプリ固有の設定画面へ遷移
17
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?