AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the Foundation URL Loading System. System, extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did.
AFNetworking is based on NSURLSession. If you want to know about NSURLSession click http://blog.youkuaiyun.com/djl4104804/article/details/22667273 ( difference of NSURLSession and NSURLConnection )
AFNetworking can download, upload (for mute-part Request, with progress) ,network state detection...(more...)
first the download task
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURL *URL = [NSURL URLWithString:@"http://www.baidu.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
} else {
NSLog(@"%@ %@", response, responseObject);
}
}];
[dataTask resume];//resume tesk if it is suspendedI will
update AFNetworking code later one by one. QAQ
AFNetworking是一款用于iOS和macOS的高效网络库,基于Foundation URL Loading System构建,并对其进行了扩展,提供强大的高级网络抽象功能。它采用模块化架构,拥有精心设计且功能丰富的API。AFNetworking支持下载、上传(包括进度显示的multipart请求)、网络状态检测等功能。
978

被折叠的 条评论
为什么被折叠?



