登录设备管理
获取登录设备列表
返回已经登录协作账号的设备信息列表。
效果展示

接口定义
swift
func getLoginDevices(completion: @escaping (_ loginDevices: [KIMLoginDevice]?, _ error: KIMError?) -> Void)
Objective-C
- (void)getLoginDevicesWithCompletion:(void (^)(NSArray<KIMLoginDevice *> *, KIMError *))completion;
参数说明
参数 | 类型 | 说明 |
---|---|---|
completion | (_ loginDevices: [KIMLoginDevice]?, _ error: KIMError?) -> Void | 获取结果回调。 loginDevices: 登录设备信息列表 error:错误信息 |
KIMLoginDevice
属性说明如下:
字段 | 类型 | 说明 |
---|---|---|
country | String | 国家 |
province | String | 省份 |
city | String | 城市 |
isp | String | 运营商: 电信 |
latitude | String | 纬度:23.12897 |
longitude | String | 经度:113.26683 |
timeZone | String | 时区:Asia/Shanghai |
utcTimeZone | String | UTC 时区: UTC+8 |
deviceid | String | 设备 id:1b227cda6c10f65f56d230f521a44e5e |
name | String | 名字:KSOGZD21000005 |
platform | String | 平台:windows |
clientVer | String | 版本:pc-woa_stable:3.15.0 |
ip | String | IP: 183.63.124.162 |
loginTime | String | 登录时间:1668928871 |
lastTime | String | 上次登录时间:1668998111 |
isCurrent | Bool | 是否当前设备 |
appName | String | app 名称:WPS协作-Windows 客户端 |
代码示例
swift
KIM.userModule.getLoginDevices { loginDevices, error in
if let loginDevices, error == nil {
// 获取登录设备成功
} else {
// 获取登录设备失败
}
}
Objective-C
[KIM.userModule getLoginDevicesWithCompletion:^(NSArray<KIMLoginDevice *> *loginDevices,
KIMError *error) {
if (loginDevices != NULL && error == nil) {
// 获取登录设备成功
} else {
// 获取登录设备失败
}
}];
退登指定登录设备
将指定已经登录的设备退登。
接口定义
swift
func kickLoginDevice(deviceId: String, completion: @escaping (_ error: KIMError?) -> Void)
Objective-C
- (void)kickLoginDeviceWithDeviceId:(NSString *)deviceId completion:(void (^)(KIMError *))completion;
参数说明
参数 | 类型 | 说明 |
---|---|---|
deviceId | String | 需要退登的设备 id |
completion | (_ error: KIMError?) -> Void | 完成回调。 error:错误信息,失败时有值 |
代码示例
swift
KIM.chatModule.kickLoginDevice(deviceId: deviceId) { error in
if error == nil {
// 设备下线成功
} else {
// 设备下线失败
}
}
Objective-C
[KIM.chatModule kickLoginDeviceWithDeviceId:deviceId completion:^(KIMError *error) {
if (error == nil) {
// 设备下线成功
} else {
// 设备下线失败
}
}];