更新时间:2024-01-24 GMT+08:00
分享

上传个人头像

uploadSelfAvatarWithFilePath:callback:

接口描述

该接口用于上传用户自己头像。

注意事项

  1. 文件路径为头像路径。
  2. 大小限制200k。
  3. 只支持jpg、png。
  4. 为了头像展示效果,建议图片宽高比为1:1。
  5. 回调error表示错误信息,nil表示成功。

方法定义

1
- (void)uploadSelfAvatarWithFilePath:(NSString *_Nullable)filePath callback:(_Nonnull HWMSDKCompleteHandler)callback;

参数描述

表1

参数

是否必须

类型

描述

filePath

NSString *

头像文件路径

返回值

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
/// 上传用户个人头像
- (void)uploadSelfAvatar {
    [[HWMBizSdk getBizOpenApi] uploadSelfAvatarWithFilePath:self.headImgPath callback:^(NSError * _Nullable error, id  _Nullable result) {
        if (error) {
            [UIUtil showMessage:[NSString stringWithFormat:@"上传失败%@", error.localizedDescription]];
        } else {
            [UIUtil showMessage:@"上传成功"];
        }
    }];
}
分享:

    相关文档

    相关产品