aliyun / aliyun-oss-ios-sdk

iOS SDK for aliyun object storage service
Other
469 stars 321 forks source link

uploadProgress 只执行一次 #282

Open Torreslol opened 3 years ago

Torreslol commented 3 years ago

上传图片的时候 uploadProgress 只回调了上传结束的那一次

        request.uploadProgress = { [weak self] bytes, totalBytes, totalBytesExpected in
        }
        let task = client.putObject(request)
        let cancellation = OSSCancellationToken()
        cancellation.registerCancellationObserver {
            completion?(.failure(.canceled))
        }
        var url = String.empty
        if let t = token,
           let res = client.presignPublicURL(withBucketName: t.bucket, withObjectKey: uploadKey).result as? String {
            url = res
        }

        task.continue(with: OSSExecutor.init(dispatchQueue: self.uploadQueue), block: { task in

            completion?(.failure(.underlying(error: error)))

        }, cancellationToken: cancellation)
wushuai1415 commented 3 years ago

你上传的文件多大,看下OSSNetworking里NSURLSession 进度的代理方法也执行一次吗

Torreslol commented 3 years ago

20k, 看了下 这里也只回调了一次

wushuai1415 commented 3 years ago

@gerald8 上传个大点试试

koalababy2024 commented 2 years ago

@wushuai1415  我也遇到这个问题了,安卓是没问题的