quickblox中的在线离线用户状态

时间:2015-07-27 07:11:16

标签: ios quickblox

我指的是quickblox中的示例iOS应用,以在我的应用中集成聊天/通话功能。但我发现SDK和Q-municate应用程序的框架存在差异。

视频/音频调用与SDK一起提供的示例应用程序运行良好,但当我尝试查找用户的在线/离线状态时,我必须包含来自Q-municate的框架。包括我无法在模拟器上运行后,它会出错

  

“架构x86_64的未定义符号”

但它在真实设备上运行。

视频通话挂在Q-municate框架的设备上,但与SDK中的框架配合得很好。

知道有什么不同吗?

1 个答案:

答案 0 :(得分:1)

更新:以下方法仍然有效。还有一种新方法可以做到这一点,这个答案发布时尚未提供。请参阅下面的更新-2部分。

要查找用户的状态(在线/离线),Quickblox建议如下:

每个用户都有lastRequestAt字段 - 显示上次用户活动时间。您可以使用它来确定用户现在是在线还是离线。

NSInteger currentTimeInterval = [[NSDate date] timeIntervalSince1970];
NSInteger userLastRequestAtTimeInterval   = [[user lastRequestAt] timeIntervalSince1970];

// if user didn't do anything last 5 minutes (5*60 seconds)    
if((currentTimeInterval - userLastRequestAtTimeInterval) > 5*60){ 
     // user is offline now
}

<强>更新-2

要查找在线用户列表,请使用以下命令:

NSMutableDictionary *filters = [NSMutableDictionary dictionary];
filters[@"filter[]"] = @"date last_request_at gt 2012-03-20T08:47:34Z";

[QBRequest usersWithExtendedRequest:filters page:[QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:100] successBlock:^(QBResponse *response, QBGeneralResponsePage *page, NSArray *users) {
     // Request succeeded   
} errorBlock:^(QBResponse *response) {
     // Handle error  
}];

取自here.

相关问题