Updated on 2024-07-30 GMT+08:00

Uploading a Profile Picture

uploadSelfAvatar: success: fail:

API Description

This API is used to upload a profile picture.

Precautions

  1. Pass the profile picture path.
  2. The maximum size is 200 KB.
  3. Only JPG and PNG files are supported.
  4. The recommended aspect ratio is 1:1.
  5. success: Success. fail: Failure. error: Error information.

Method Definition

1
- (void)uploadSelfAvatar:(NSString *)path success:(void (^)(void))success fail:(void (^)(NSError *error))fail;

Parameter Description

Table 1

Parameter

Mandatory

Type

Description

path

Yes

NSString

Full path of an image.

Return Values

None

Sample Code

1
2
3
4
5
6
7
8
/// Upload a profile picture.
- (void)uploadSelfAvatar {
    [[HWMBizSdk getBizOpenApi] uploadSelfAvatar:path success:^{
        NSLog(@"set succeeded");
    } fail:^(NSError *_Nonnull error) {
        NSLog(@"%@", error.description);
    }];
}