Help Center/ Meeting/ Client SDK Reference/ macOS SDK/ APIs/ UI Customization/ Customizing the Profile Picture
Updated on 2024-07-30 GMT+08:00

Customizing the Profile Picture

downloadHeadPortraitWithThirdAccount: account: number: completionBlock:

API Description

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

Figure 1 Effect of blocking the 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 1

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);
    }
}