You need to enable JavaScript to run this app.
导航

进阶功能

最近更新时间2022.10.19 11:39:14

首次发布时间2022.10.19 11:39:14

本文为您介绍素材上传的进阶功能。

其他配置项

上传 SDK 还支持一些自定义配置,您可以根据需要,在开始上传前,调用 setUploadConfig 方法进行配置。

- (void)setUploadConfig:(NSDictionary*)config;

其中 config dictionary 可选字段和取值类型说明如下表所示。

字段名类型说明
BDFileUploadSliceSizeNSNumber(NSInteger)设置分片大小,单位:byte,默认 512KB
BDFileUploadSocketNumNSNumber(NSInteger)分片上传时的并发连接数
BDFileUploadTcpOpenTimeOutMilliSecNSNumber(NSInteger)单次tcp 建连超时,单位: ms, 默认值 5000
BDFileUploadMaxFailTimesNSNumber(NSInteger)建立连接超时,单位:s
BDFileUploadRWTimeoutNSNumber(NSInteger)单个分片传输超时时间,单位: s,默认值 40
BDFileUploadSliceRetryCountNSNumber(NSInteger)单分片上传可以重试的次数
BDFileUploadFileRetryCountNSNumber(NSInteger)文件级别的上传重试次数
BDFileUploadTranTimeOutUnitNSNumber(NSInteger)系统 socket 单次读写超时,单位:s,默认 70
BDFileUploadAliveMaxFailTimeNSNumber(NSInteger)复用连接的超时时间
BDFileUploadHttpsEnableNSNumber(BDUploadHttpsOpen)开启https,可以根据上传阶段分步开

如下为实现的示例代码。

[self.materialUploadClient setUploadConfig:@{
    // 指定文件分片大小, 512KB
    BDFileUploadSliceSize:@(512 * 1024),
}];