【问题标题】:Get User's Notification settings获取用户的通知设置
【发布时间】:2018-08-31 19:15:54
【问题描述】:

概述

  • 我想让用户关闭通知声音。
  • 通常为了做到这一点,必须打开应用程序设置(如图所示从设置应用程序)并关闭通知声音。

目标

  • 我想在应用设置屏幕中显示声音的值,这样如果它打开,用户可以转到应用设置并关闭它,反之亦然。

我尝试用 Google 搜索我的问题并遇到了 this,但解决方案中提供的链接已被删除。

【问题讨论】:

标签: ios swift settings application-settings unnotificationrequest


【解决方案1】:

如果您特别想阅读通知设置和选项,您可以这样做。然后,如果他们想更改设置,您可以直接将它们带到设置应用程序中。

    UNUserNotificationCenter.current().getNotificationSettings(){ (settings) in

        switch settings.soundSetting{
        case .enabled:
            print("setting enabled")
        case .disabled:
            print("setting has been disabled")
        case .notSupported:
            print("somethings wrong here")
        }
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多