更新时间:2023-03-23 GMT+08:00

头像拦截显示

queryContactAvatarWithAccount:thirdUserId:number:completionBlock:

接口描述

该接口用于定制登录后的会中头像显示。

图1 生效后拦截头像显示效果

注意事项

  1. 未登录的头像不支持自定义。

方法定义

1
2
- (void)queryContactAvatarWithAccount:(NSString *)account thirdUserId:(NSString *)thirdUserId number:(NSString *)number
                     completionBlock:(void(^)(NSError * _Nullable error, UIImage * _Nullable avatarImage))completionBlock;

参数描述

表1

参数

类型

描述

account

NSString *

帐号密码登录场景下优先使用此字段

thirdUserId

NSString *

appid登录场景下优先使用此字段

number

NSString *

跨企业场景优先使用此字段

返回值

示例代码
1
2
3
4
5
6
7
/// 拦截头像显示
- (void)queryContactAvatarWithAccount:(NSString *)account thirdUserId:(NSString *)thirdUserId number:(nonnull NSString *)number
                      completionBlock:(void(^)(NSError * _Nullable error, UIImage * _Nullable avatarImage))completionBlock {
    /// 根据account或者thirdUserId 设置图片,下面的仅为示例代码
    UIImage *image = [UIImage imageNamed:@"custom_conf_setting"];
    completionBlock(nil, image);
}