Network
Ansel_m
阿里天猫
展开
-
NSURLCache
NSURLCache 为您的应用的 URL 请求提供了内存中以及磁盘上的综合缓存机制。 作为基础类库 URL 加载系统 的一部分,任何通过 NSURLConnection 加载的请求都将被 NSURLCache 处理。网络缓存减少了需要向服务器发送请求的次数,同时也提升了离线或在低速网络中使用应用的体验。当一个请求完成下载来自服务器的回应,一个缓存的回应将在本地保存。下一次同一转载 2014-07-25 15:11:04 · 1194 阅读 · 0 评论 -
NSOperationQueue和NSOperation
最近一直在看开源库AFNetworking,很值得学习,在看的过程中发现自己在HTTP协议方面很薄弱,有时间一定要好好的看看,感觉很有用。AFNetworking库中是主要使用NSOperationQueue和NSOperation两个类来处理网络request,发现在其中有些概念自己以前理解有误,所以决定写一篇好好总结一下,主要摘自苹果官网文档。1.NSOperationQueue转载 2014-08-05 17:19:34 · 9320 阅读 · 0 评论 -
iOS7 Networking with NSURLSession: Part 3
In the previous tutorials, we explored the fundamentals of the NSURLSession API. There is one other feature of the NSURLSession API that we haven't look into yet, that is, out-of-process uploads a转载 2014-07-28 18:49:56 · 1266 阅读 · 0 评论 -
iOS7 Networking with NSURLSession: Part 4
In the previous tutorial, we started creating a simple podcast client to put what we've learned about NSURLSession into practice. So far, our podcast client can query the iTunes Search API, download转载 2014-07-28 18:51:02 · 1168 阅读 · 0 评论 -
iOS7 Networking with NSURLSession: Part 2
In the previous tutorial, I introduced you to NSURLSession. I talked about the advantages it has over NSURLConnection and how to use NSURLSession for simple tasks, such as fetching data from a w转载 2014-07-28 16:43:52 · 1110 阅读 · 0 评论 -
iOS7 Networking with NSURLSession: Part 1
From a developer's perspective, one of the more significant changes in iOS 7, and OS X Mavericks for that matter, is the introduction of NSURLSession. Even thoughNSURLSession may seem daunting at fi转载 2014-07-28 15:34:29 · 1139 阅读 · 0 评论 -
NSURLConnection
说到 iOS 7 和 Mac OS X 10.9 Mavericks 的显著变化,其中一个就是Foundation框架中URL加载系统的优化。此时可能有人正沉浸在Apple的网络基础架构,我想在这里分享一下我对这些新APIs的看法,并展示这些新APIs如何改变我们构建应用程序的方式,以及这些它们在API设计理念演变中的意义。作为Core Foundation / CFNetwork转载 2014-07-26 10:17:22 · 1521 阅读 · 0 评论 -
NSHTTPCookieStorage
cookie机制采用的是在客户端保持 HTTP 状态信息的方案 Cookie是在浏览器访问WEB服务器的某个资源时,由WEB服务器在HTTP响应消息头中附带传送给浏览器的一个小文本文件。 一旦WEB浏览器保存了某个Cookie,那么它在以后每次访问该WEB服务器时,都会在HTTP请求头中将这个Cookie回传给WEB服务器。 底层的实现原理: WEB服务器通过在HTTP响应消息中增转载 2014-07-26 09:54:33 · 14334 阅读 · 3 评论 -
NSURLSession学习笔记(三)Download Task
NSURLSession的Download Task用于完成下载任务,本文介绍如何创建断点续传的下载任务和后台下载任务。我们直接从分析Demo入手:故事板如下:只有一个View Controller,用于创建各种下载任务,并将下载后的图片显示到视图上,下载过程中会更新下载进度。头文件代码如下:[objc]转载 2014-07-26 00:12:56 · 27205 阅读 · 7 评论 -
NSURLSession学习笔记(二)Session Task
Session Task分为三种Data Task,Upload Task,Download Task。毫无疑问,Session Task是整个NSURLSession架构的核心目标。下面写了一个简单的Demo来初步使用下三种任务对象。这里使用的是convenience methods,并没有定制session和使用协议,都是采用completionHandler作为回调动作。转载 2014-07-26 00:10:29 · 37942 阅读 · 1 评论 -
NSURLSession学习笔记(一)简介
一、URL Session的基本概念1.三种工作模式:默认会话模式(default):工作模式类似于原来的NSURLConnection,使用的是基于磁盘缓存的持久化策略,使用用户keychain中保存的证书进行认证授权。瞬时会话模式(ephemeral):该模式不使用磁盘保存任何数据。所有和会话相关的caches,证书,cookies等都被保存在RAM中,因此当程序使会话转载 2014-07-26 00:05:54 · 36556 阅读 · 3 评论 -
AFNetworking 2.0
名鼎鼎的开源网络库AFNetworking 2.0,目前只是翻译了Github上的链接文章,使用教程请点击http://www.cnblogs.com/YouXianMing/p/3651462.html https://github.com/AFNetworking/AFNetworking AFNetworking is a delightful net转载 2014-07-25 18:20:23 · 5913 阅读 · 0 评论 -
array add block
//MRC- (void)exampleB_addBlockToArray:(NSMutableArray*)array{ NSString *str = @"122"; void (^myBlock)() = ^() { NSLog(@"----str:%@---", str); }; [array addObject:[[my原创 2014-07-30 17:50:56 · 960 阅读 · 0 评论