当前位置: 首页 > 文档资料 > Rokid IOS SDK 文档 >

通用通知

优质
小牛编辑
137浏览
2023-12-01

通用通知消息

消息体

ChannelMessage

例子

Swift:

NotificationCenter.rokidsdk.addObserver(self, selector: #selector(handleChannelMsgsNotification(_:)), name: NSNotification.Name(rawValue: SDKNotificationName.ChannelMessages ), object: nil)

@objc private func handleChannelMsgsNotification(_ notification: Notification) {
    print("\(String(describing: notification.userInfo))")
    print("handleChannelMsgsNotification:", notification)
}

Objc

[NSNotificationCenter.rokidsdk addObserver:self selector:@selector(handleChannelMsgsNotification:) name:SDKNotificationName.ChannelMessage object:nil];

- (void)handleChannelMsgsNotification: (NSNotification *)notification {
    NSLog(@"%@", notification.userInfo);
    NSLog(@"handleChannelMsgsNotification %@", notification.object);
}