0
1

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 1 year has passed since last update.

【Swift】プッシュ通知設定を判別するコード

Last updated at Posted at 2023-02-22

概要

Swiftでプッシュ通知設定を判別するコード

コード


UNUserNotificationCenter.current().getNotificationSettings { settings in
    switch settings.authorizationStatus {
        case .notDetermined:
            print("許可設定を行っていない")
        case .denied:
            print("通知が拒否されている")
        case .authorized:
            print("通知が許可されている")
        case .provisional:
            print("Provisional Authorizationが有効になっている")
        case .ephemeral:
            print("限られた時間内の通知が有効")
    }
}

参考

Swiftのお役立ち情報

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?