在锁屏模式下隐藏操作按钮 - iOS通知Swift 4.2

问题描述 投票:0回答:1

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

有没有办法在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个回答
1
投票

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.