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

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 源码吧,也可以私聊我,我运行试试,提供更多信息,有助于定位和解答你的问题。

  • 2***@qq.com (作者)

    我已经搞定啦

    2024-10-25 13:36

要回复问题请先登录注册

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容