iOS NSUrlConnection检查上传速度 [英] iOS NSUrlConnection check upload speed

查看:195
本文介绍了iOS NSUrlConnection检查上传速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将文件上传到HTTP服务器.我知道我可以使用方法获得上传进度

i upload files to HTTP server. I know I can get upload progres with method

- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite

但是有什么方法可以提高上传速度吗?

but is there any way to get upload speed?

推荐答案

来自问题我得到了这个答案,尽管它是关于下载速度的,但是您也可以从中计算出上传速度.测量上传的字节差和调用代理之间的时间差,然后可以计算正在进行的速度,以每秒字节数(或其他时间单位)为单位.

From a question I got this answer though it was for download speed but You can also calculate upload speed form this. Measure the difference in bytes uploaded and the difference in time between calls to the delegate, then you can calculate the ongoing speed in bytes per second (or other time unit).

另一个答案可以为您提供帮助. 更多参考(从评论中添加).

There is another answer that can help you. One more reference (added from comment).

希望这会有所帮助..:)

Hope this helps .. :)

这篇关于iOS NSUrlConnection检查上传速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆