跳到主要内容

uploadFile

功能介绍

说明

通过 SDK 上传文件。

### 函数原型

- (void)uploadFile:(NSString *)fullPath
name:(NSString * _Nullable)name
cause:(NSString * _Nullable)cause
onProgress:(OIMUploadProgressCallback)onProgress
onCompletion:(OIMUploadCompletionCallback)onCompletion
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;

输入参数

参数名称参数类型是否必填描述
fullPathNSString文件在本机的完整路径
causeNSString文件分类
nameNSString文件名字

返回结果

名称类型描述
onProgressNSInteger上传进度
onCompletionOIMUploadCompletionCallback上传完成
onSuccessOIMSuccessCallback成功返回
onFailureOIMFailureCallback失败返回

代码示例


[OIMManager.manager uploadFile:@""
name:nil
cause:nil
onProgress:^(NSInteger saveBytes, NSInteger currentBytes, NSInteger totalBytes) {

} onCompletion:^(NSInteger totalBytes, NSString * _Nonnull url, NSInteger putType) {

} onSuccess:^(NSString * _Nullable data) {

} onFailure:^(NSInteger code, NSString * _Nullable msg) {

}];