Objective c 如何获取PubNub的单个未读邮件数?

Objective c 如何获取PubNub的单个未读邮件数?,objective-c,swift3,pubnub,Objective C,Swift3,Pubnub,我正在使用pubnub服务将聊天功能添加到我的应用程序中,但我想知道是否有办法获取未读邮件的个人数量。我正在使用此链接->这可以通过实现。函数是您自己的脚本,当消息在一个或多个PubNub频道上发布时,它会自动在云中运行 它有一个键值存储,具有递增、递减和检索功能。这可以非常直观地用于PubNub上的未读消息模式 频道:房间* 事件:发布前打开 // Access to Distributed Database const db = require('kvstore'); export defa

我正在使用pubnub服务将聊天功能添加到我的应用程序中,但我想知道是否有办法获取未读邮件的个人数量。我正在使用此链接->

这可以通过实现。函数是您自己的脚本,当消息在一个或多个PubNub频道上发布时,它会自动在云中运行

它有一个键值存储,具有
递增
递减
检索
功能。这可以非常直观地用于PubNub上的未读消息模式

频道:房间*

事件:发布前打开

// Access to Distributed Database
const db = require('kvstore');
export default (request) => { 
    // Conventionally build the Key ID based on the request parameters and channel name.
    let counterId = request.channels[0] + '/' + request.params.uuid;
    // Increment or Decrement the unread message counter
    let method = request.message.read ? -1 : 1;
    // Increment/Decrement and read the unread message counter
    return db.incrCounter( counterId,  method ).then(()=>{
        return db.getCounter(counterId).then((counter) => {
            request.message.unread = counter || 0;
            return request.ok();
        });
    });
}

在此之后您可以将此新功能集成到现有应用程序中。

您检查过此url吗@谢谢你的支持。我正在检查。@17我已经检查过了,这个链接说未读邮件总数是可以计算的,但我的要求是单个未读邮件,而不是总数。