17
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

アプリ内からiPhoneの「設定」アプリの通知設定画面に遷移する方法 (iOS 16~)

Posted at

アプリからiPhoneの設定アプリを開くには UIApplication.openSettingsURLString を使いますが、そこから先のアプリごとの通知設定画面へ遷移させるようなURLは以前は提供されていませんでした。

しかしiOS 16から openNotificationSettingsURLString が追加されており、iPhoneの設定アプリ内にあるプッシュ通知の設定画面へ一発で遷移できるようになりました。
Appleありがとう。(みんなURLScheme使ってリジェクトされたりしてましたよね。。)

使い方

if let url = URL(string: UIApplication.openNotificationSettingsURLString) {
    await UIApplication.shared.open(url)
}

※ ちなみに中身は app-settings:notifications という値になっていました。

print(UIApplication.openSettingsURLString)
// app-settings:

print(UIApplication.openNotificationSettingsURLString)
// app-settings:notifications

openNotificationSettingsURLString 使っていきましょう。

17
13
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
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?