最近更新时间:2022.10.19 11:39:14
首次发布时间:2022.10.19 11:39:14
本文为您介绍素材上传的进阶功能。
上传 SDK 还支持一些自定义配置,您可以根据需要,在开始上传前,调用 setUploadConfig
方法进行配置。
- (void)setUploadConfig:(NSDictionary*)config;
其中 config dictionary 可选字段和取值类型说明如下表所示。
字段名 | 类型 | 说明 |
---|---|---|
BDFileUploadSliceSize | NSNumber(NSInteger) | 设置分片大小,单位:byte,默认 512KB |
BDFileUploadSocketNum | NSNumber(NSInteger) | 分片上传时的并发连接数 |
BDFileUploadTcpOpenTimeOutMilliSec | NSNumber(NSInteger) | 单次tcp 建连超时,单位: ms, 默认值 5000 |
BDFileUploadMaxFailTimes | NSNumber(NSInteger) | 建立连接超时,单位:s |
BDFileUploadRWTimeout | NSNumber(NSInteger) | 单个分片传输超时时间,单位: s,默认值 40 |
BDFileUploadSliceRetryCount | NSNumber(NSInteger) | 单分片上传可以重试的次数 |
BDFileUploadFileRetryCount | NSNumber(NSInteger) | 文件级别的上传重试次数 |
BDFileUploadTranTimeOutUnit | NSNumber(NSInteger) | 系统 socket 单次读写超时,单位:s,默认 70 |
BDFileUploadAliveMaxFailTime | NSNumber(NSInteger) | 复用连接的超时时间 |
BDFileUploadHttpsEnable | NSNumber(BDUploadHttpsOpen) | 开启https,可以根据上传阶段分步开 |
如下为实现的示例代码。
[self.materialUploadClient setUploadConfig:@{ // 指定文件分片大小, 512KB BDFileUploadSliceSize:@(512 * 1024), }];