iOS 如何知道用户在 quickblox 中在线还是离线?
How to know user is online or offline in quickblox for iOS?
我在 arrContactList 中存储用户联系人
NSArray *arrContactList = [QBChat instance].contactList.contacts;
如何从 arrContactList 导出在线状态。
同样在获取在线状态后,如果用户在线或离线,如何找到它。
// 联系人有用户 ID 和在线状态
for(QBContactListItem *contact in arrContactList) {
BOOL isOnline = contact.isOnline;
NSInteger userIdValue = contact.userID;
if(isOnline) {
NSLog(@"User %ld is online",(long)userIdValue);
}
else {
NSLog(@"User %ld is offline",(long)userIdValue);
}
}
//联系人用户上线或下线时调用该方法
- (void)chatDidReceiveContactItemActivity:(NSUInteger)userID isOnline:(BOOL)isOnline status:(NSString *)status{
// here you can check presence status using isOnline and also we get userID
// so list of user IDs who are online can be maintained in an array
}
我在 arrContactList 中存储用户联系人
NSArray *arrContactList = [QBChat instance].contactList.contacts;
如何从 arrContactList 导出在线状态。
同样在获取在线状态后,如果用户在线或离线,如何找到它。
// 联系人有用户 ID 和在线状态
for(QBContactListItem *contact in arrContactList) {
BOOL isOnline = contact.isOnline;
NSInteger userIdValue = contact.userID;
if(isOnline) {
NSLog(@"User %ld is online",(long)userIdValue);
}
else {
NSLog(@"User %ld is offline",(long)userIdValue);
}
}
//联系人用户上线或下线时调用该方法
- (void)chatDidReceiveContactItemActivity:(NSUInteger)userID isOnline:(BOOL)isOnline status:(NSString *)status{
// here you can check presence status using isOnline and also we get userID
// so list of user IDs who are online can be maintained in an array
}