2***@qq.com
2***@qq.com
  • 发布:2024-10-17 11:17
  • 更新:2024-10-18 12:00
  • 阅读:22

UserNotificationCenter 通知回调 无法监听

分类:uts
export class MyNotificationDelegate implements UNUserNotificationCenterDelegate {  
    /**  
     * Constructor for MyNotificationDelegate class.  
     * Initializes the delegate and logs a message for debugging.  
     */  
    constructor() {  
        // 在这里可以做一些初始化工作  
        console.log("MyNotificationDelegate 实例已创建");  
    }  

    /**  
     * This method is called when a notification arrives while the app is running in the foreground.  
     * It ensures that alerts, sounds, and badges are still shown.  
     */  
    userNotificationCenter(  
        notification: UserNotifications.UNNotification    ): void {  
        // 打印收到的通知内容,方便调试  
        console.log("接收到通知,内容:", notification);  
        console.log("abcd");  

    }  
}
2024-10-17 11:17 负责人:无 分享
已邀请:
DCloud_UNI_OttoJi

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信

看着是 ios 的通知,目前信息太少了,提供完整的 uts 源码吧,也可以私聊我,我运行试试,提供更多信息,有助于定位和解答你的问题。

要回复问题请先登录注册