LoginSignup
2
3

More than 3 years have passed since last update.

iOS設定アプリ内のアプリ設定画面を開く

Posted at

はじめに

位置情報取得や画像取得などについて、初回の許可設定で拒否されてしまうと、その後ずっとそれらのデータを取得できない状態になってしまいます。

このような場合にiOS設定アプリ内の画面から設定変更してもらうために設定画面を自動で表示するのが効果的です。

設定画面の表示方法を説明します。

やり方

決まったURLをopenするだけです。
URLは、UIApplication.openSettingsURLStringで取得できるので、下記のようにそのURLをopenするだけです。

設定画面を表示する.swift
    let url = URL(string: UIApplication.openSettingsURLString)!
    UIApplication.shared.open(url, options: [:], completionHandler: nil)

確認環境

Xcode: 12.4
iOS: 14.4

2
3
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
2
3