- 确认上传文件的大小是否适合使用AWS Transfer Utility进行上传。如果上传的文件大小超过100MB,建议使用AWS S3分块上传。
- 实现AWS Transfer Utility的代理方法,以监控上传过程中发生的事件。可使用以下代理方法:
- (void)transferUtility:(AWSS3TransferUtility *)transferUtility
task:(AWSS3TransferUtilityTask *)task
didWriteData:(int64_t)bytesSent
totalBytesSent:(int64_t)totalBytesSent
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
// 在此添加上传进度的监听代码
}
- (void)transferUtility:(AWSS3TransferUtility *)transferUtility
task:(AWSS3TransferUtilityTask *)task
didCompleteWithError:(NSError *)error {
// 在此添加上传完成操作的代码
}
- 使用合适的上传方式。AWS Transfer Utility支持三种上传方式:常规,加速和单线程。如果上传速度较慢,可以尝试使用加速或单线程上传方式。
- 确认您的AWS S3存储桶的区域与AWS Transfer Utility SDK的区域设置相匹配。如果不匹配,则上传速度可能会受到影响。