Help Center/ Meeting/ Client SDK Reference/ macOS SDK/ APIs/ UI Customization/ Customizing the Profile Picture
Updated on 2025-05-29 GMT+08:00

Customizing the Profile Picture

queryContactAvatarWithContactInfo: completionBlock:

API Description

This API is used to customize the profile picture displayed after login.

Figure 1 Effect of a custom profile picture

Precautions

  1. The profile picture of a user who has not logged in cannot be customized.
  2. Profile pictures can be uploaded (see the API for uploading a profile picture) or implemented through injection. If both methods are used, the injected profile picture takes precedence. The profile picture uploaded to the server will not be used in this case.

Method Definition

1
2
- (void)queryContactAvatarWithContactInfo:(HWMUISDKContactInfoModel *)contactInfo
                          completionBlock:(void (^)(NSError *_Nullable error, NSString *_Nullable headImagePath))completionBlock;

Parameter Description

Table 1 HWMUISDKContactInfoModel description

Parameter

Type

Description

thirdUserId

NSString

This parameter is preferentially used in the app ID login scenario.

accountId

NSString

This parameter is preferentially used in the account and password login scenario.

number

NSString

This parameter is preferentially used in the cross-enterprise scenario.

corpId

NSString

Enterprise ID.

Return Values

None

Sample Code

- (void)downloadHeadPortraitWithThirdAccount:(HWMUISDKContactInfoModel *)contactInfo completionBlock:(void (^)(NSError * _Nullable, NSString * _Nullable))completionBlock {
    if (completionBlock) {
        /// Return the image path to the SDK.
        NSInteger index = arc4random() % 3;
        NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:[NSString stringWithFormat:@"head_icon_%lu", index] ofType:@"png"];
        
        completionBlock(nil, path);
    }
}

downloadHeadPortraitWithThirdAccount: account: number: completionBlock:

API Description

This API is used to customize the profile picture displayed after login.

Figure 2 Effect of a custom profile picture

Precautions

  1. The profile picture of a user who has not logged in cannot be customized.
  2. Profile pictures can be uploaded (see the API for uploading a profile picture) or implemented through injection. If both methods are used, the injected profile picture takes precedence. The profile picture uploaded to the server will not be used in this case.

Method Definition

1
- (void)downloadHeadPortraitWithThirdAccount:(NSString *)thirdAccount account:(NSString *)account number:(NSString *)number completionBlock:(void (^)(NSError * _Nullable, NSString * _Nullable))completionBlock

Parameter Description

Table 2 Description

Parameter

Type

Description

thirdAccount

NSString

This parameter is preferentially used in the app ID login scenario.

account

NSString

This parameter is preferentially used in the account and password login scenario.

number

NSString

This parameter is preferentially used in the cross-enterprise scenario.

Return Values

None

Sample Code

- (void)downloadHeadPortraitWithThirdAccount:(NSString *)thirdAccount account:(NSString *)account number:(NSString *)number completionBlock:(void (^)(NSError * _Nullable, NSString * _Nullable))completionBlock {
    if (completionBlock) {
        /// Return the image path to the SDK.
        NSInteger index = arc4random() % 3;
        NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:[NSString stringWithFormat:@"head_icon_%lu", index] ofType:@"png"];
        
        completionBlock(nil, path);
    }
}