Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios quickblox中的在线-离线用户状态_Ios_Quickblox - Fatal编程技术网

Ios quickblox中的在线-离线用户状态

Ios quickblox中的在线-离线用户状态,ios,quickblox,Ios,Quickblox,我指的是quickblox中的iOS示例应用程序,它将聊天/通话功能集成到我的应用程序中。但我发现SDK和Q-municate应用程序的框架有所不同 视频/音频通话与随附的示例应用程序配合使用效果良好,但当我试图查找用户的在线/离线状态时,我不得不从中加入框架。包括我不能在模拟器上运行之后,它给出了错误 “架构x86_64的未定义符号” 但它在真正的设备上运行 视频调用挂起在具有Q-municate框架的设备上,但在SDK中的框架下工作良好 知道有什么区别吗???更新:以下方法仍然有效。还有一种

我指的是quickblox中的iOS示例应用程序,它将聊天/通话功能集成到我的应用程序中。但我发现SDK和Q-municate应用程序的框架有所不同

视频/音频通话与随附的示例应用程序配合使用效果良好,但当我试图查找用户的在线/离线状态时,我不得不从中加入框架。包括我不能在模拟器上运行之后,它给出了错误

“架构x86_64的未定义符号”

但它在真正的设备上运行

视频调用挂起在具有Q-municate框架的设备上,但在SDK中的框架下工作良好


知道有什么区别吗???

更新:以下方法仍然有效。还有一种新的方法可以做到这一点,这在发布此答案时是不可用的。请参阅下面的更新-2部分。

要查找用户的状态(联机/脱机),Quickblox建议如下:

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  
}];
每个用户都有
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  
}];

中可以看出,该解决方案并不可靠,因为它完全取决于时间,而不是实时状态。
lastRequestAt
始终是
nil
我只在用户登录或注销时得到,而不是在发送或接收消息时[user lastRequestAt]你能帮我摆脱困境吗this@FeminaBrahmbhatt不确定你在寻找什么,你能详细说明你面临的问题吗,我很乐意帮助你。检查这个-