【问题标题】:Hide action buttons on Lock Screen Mode - iOS Notification Swift 4.2在锁定屏幕模式下隐藏操作按钮 - iOS Notification Swift 4.2
【发布时间】:2019-02-28 14:47:58
【问题描述】:

我想在锁定屏幕模式下隐藏这些操作按钮。

有没有办法在 iOS 中检测到这一点?

if action == "allow.action" {

    APIService.shared.updateCpeDeviceACL(cpe: cpe,vlan: vlan, device: deviceMac ?? "", portalUrl: "", acl: true, caller: self)

    if(alertId != nil){
        APIService.shared.deleteAlert(id: alertId ?? "", caller: self)
    } else {
        print("alertId = nil detetected !")
    }

    if(notificationType != "new-device"){

        if(quarantineId != nil){
            APIService.shared.allowDeviceToNetwork(id: quarantineId ?? "", caller: self)
        } else {
            print("quarantineId = nil detetected !")
        }

    }


} else if action == "delete.action" {

    APIService.shared.deleteAlert(id: alertId ?? "", caller: self)

} else if action == "block.action" {

    APIService.shared.updateCpeDeviceACL(cpe: cpe,vlan: vlan, device: deviceMac ?? "", portalUrl: "", acl: false, caller: self)

    if(alertId != nil){
        APIService.shared.deleteAlert(id: alertId ?? "", caller: self)
    } else {
        print("alertId = nil detetected !")
    }


    if(notificationType != "new-device"){

        if(quarantineId != nil){
            APIService.shared.denyDeviceToNetwork(id: quarantineId ?? "", caller: self)
        } else {
            print("quarantineId = nil detetected !")
        }

    }


} else {
    awakeFromNotification = true
}

如何进一步调试?

【问题讨论】:

    标签: swift push-notification apple-push-notifications swift4 swift4.2


    【解决方案1】:

    我猜您指的是可操作的通知?如果在您的代码中的某处是这样,您应该能够看到:

    UNUserNotificationCenter.current().setNotificationCategories([someCategory])
    

    创建 someCategory(应用中使用的任何名称)时,它应该接收这些操作作为参数。你可以在那里修改它们。

    【讨论】:

      猜你喜欢
      • 2022-10-05
      • 1970-01-01
      • 1970-01-01
      • 2011-05-01
      • 2014-04-24
      • 1970-01-01
      • 1970-01-01
      • 2019-05-25
      • 2015-12-13
      相关资源
      最近更新 更多