对于dispatch多个异步操作后的同步方法,以前只看过dispatch_group_async,看看这个方法的说明: * @discussion * Submits a block to a dispatch queue and associates the block with the given * dispatch group. The dispatch group may be used to wait for the completion * of the blocks it ref
在日常应用中,我们往往使用AFNetworking等第三方库来实现网络请求部分.这篇文章会简要地介绍一下如何使用NSURLConnection来进行异步的网络请求. 我们先看一个小demo - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *urlStr = @"http://www.baidu.c
工作这么长时间,起初还是喜欢用面向程序过程的思路去写代码. 慢慢的才会用面向对象的思路分析.解决问题.也算是一点点进步吧. 最近在做一个下载音乐的功能.用到了HttpClient类. 于是就简单的写了一个文件处理类.主要实现了Get请求,Post还很不完善(Post看到过别人写的很不错的类,以后会贴出). 还有能够实时的显示下载进度,中断下载. 贴出代码,在代码里解释: public class HttpRequest { #region Instance Field private reado