网站已改版,请使用新地址访问:
AFNETWorking 是用基于 网络框架实现的一个现在功能,可以 多个任务同 载,断点 iPhone 238万源代码下载-
&文件名称: AFNETWorking
& & & & &&]
&&所属分类:
&&开发工具: Objective-C
&&文件大小: 305 KB
&&上传时间:
&&下载次数: 30
&&提 供 者:
&详细说明:是用基于afnetworking 网络框架实现的一个现在功能,可以实现多个任务同时下载,断点续传等功能 ,用于ios客户端下载功能实现。
-Is based framework of the afnetworking network to achieve a function, you can achieve multiple tasks simultaneously download, HTTP and other functions for the IOS client download functions.
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&AFNETWorking\AFResumingDownload\.DS_Store&&............\..................\.git\COMMIT_EDITMSG&&............\..................\....\config&&............\..................\....\description&&............\..................\....\HEAD&&............\..................\....\hooks\applypatch-msg.sample&&............\..................\....\.....\commit-msg.sample&&............\..................\....\.....\post-update.sample&&............\..................\....\.....\pre-applypatch.sample&&............\..................\....\.....\pre-commit.sample&&............\..................\....\.....\pre-rebase.sample&&............\..................\....\.....\prepare-commit-msg.sample&&............\..................\....\.....\update.sample&&............\..................\....\index&&............\..................\....\..fo\exclude&&............\..................\....\logs\HEAD&&............\..................\....\....\refs\heads\master&&............\..................\....\objects\11\54b85afc51c50f8ca9a82e3a63b4aafd8fbec7&&............\..................\....\.......\.4\f133fb2ec4675b8&&............\..................\....\.......\.c\8bfb81ba9dd795cbfd56da81c0&&............\..................\....\.......\21\961d05267dfcf1fa570c65d301d3e9b54521d8&&............\..................\....\.......\.4\9eef9d35ddd2d4df698b5ba83b8b4a&&............\..................\....\.......\.a\ef09a451fd6d32febd&&............\..................\....\.......\39\8a474ad6cfecb9e49&&............\..................\....\.......\45\fa7fb8d4817fdcb8efbc65a2aad48a&&............\..................\....\.......\.7\7b28ff8f86a4fbd3aa&&............\..................\....\.......\.9\e596cc01f4de50dfaba5a9ff11d6&&............\..................\....\.......\.d\1a75ef9effd6a8964&&............\..................\....\.......\.f\ab26bdf221c4375dbeef691c920d&&............\..................\....\.......\52\de1f750b27dfac421aa96fed0f53&&............\..................\....\.......\.5\afee8b5cbc&&............\..................\....\.......\.6\afdcd82cdeb6c47b0b&&............\..................\....\.......\.9\718f88a570f47aca93e&&............\..................\....\.......\60\915af223facdeace78e6551dafed&&............\..................\....\.......\.9\11eb&&............\..................\....\.......\73\1aedaf5ef99d94db7&&............\..................\....\.......\.4\3f98b9abc94f84bf1&&............\..................\....\.......\81\bfeed42ffbf7968c4&&............\..................\....\.......\.d\bea5e06b4ddb98b24&&............\..................\....\.......\.f\ef511a134b3d3ab4bf17b12127caf&&............\..................\....\.......\..\f123a44d9a7ebbed&&............\..................\....\.......\91\ebeb774a8f2ec18becb36c9ddd16&&............\..................\....\.......\.2\9c48a3f8cbbc7f13a3e003fb2b4e&&............\..................\....\.......\.3\3ff110e28f3d170f99c8e19db7ad2b3cdf98a6&&............\..................\....\.......\.a\26aa5f1a7a52156bd&&............\..................\....\.......\a9\4e4bc6ba019e2db0&&............\..................\....\.......\b1\32e989ac2e6810b96fab0ecb1c4d&&............\..................\....\.......\.b\ffa363083ecc4f77dd5ae25bfd63e8cc129ee6&&............\..................\....\.......\.c\7f2a8fb1e6d297b754c8f9cba1d6&&............\..................\....\.......\..\a959c44d643cce80d0c3ad97d3c7&&............\..................\....\.......\.d\c935c352b21f938aac8fa&&............\..................\....\.......\c5\09274eca9d8b1fec51bb229fd0e3&&............\..................\....\.......\.9\c5f093b62a8f0b81dbd1f0acf3&&............\..................\....\.......\.a\16d423e0a61c0ef5fbb51cf559ad&&............\..................\....\.......\d4\baa0ebfeaf91d3d6e8e6efdd784d&&............\..................\....\.......\.6\94c35e7f4b6a2fa05ffe8a2e3ee2&&............\..................\....\.......\.d\a196cdd9ef1ea60841dfe1f1a4bf&&............\..................\....\.......\.e\62e9eb745b8ee0f6e6effc90e7&&............\..................\....\.......\e1\f7803c88ecd55b64bb3aeeaa841d&&............\..................\....\.......\.7\178e4daa48de33b966fe&&............\..................\....\.......\..\e27d62ac2e68fb1b2d709b40aa9ba2edbbe3fd&&............\..................\....\.......\.a\dcd56c12f3faca3588&&............\..................\....\.......\f5\c438e0f4c784dabc345a27e8bb779f2688a27c&&............\..................\....\refs\heads\master&&............\..................\AFResumingDownload\AFDownloadRequestOperation.h&&............\..................\..................\AFDownloadRequestOperation.m&&............\..................\..................\AFHTTPClient.h&&............\..................\..................\AFHTTPClient.m&&............\..................\..................\AFHTTPRequestOperation.h&&............\..................\..................\AFHTTPRequestOperation.m&&............\..................\..................\AFImageRequestOperation.h&&............\..................\..................\AFImageRequestOperation.m&&............\..................\..................\AFJSONRequestOperation.h&&............\..................\..................\AFJSONRequestOperation.m&&............\..................\..................\AFNetworkActivityIndicatorManager.h&&............\..................\..................\AFNetworkActivityIndicatorManager.m&&............\..................\..................\AFNetworking.h&&............\..................\..................\AFPropertyListRequestOperation.h&&............\..................\..................\AFPropertyListRequestOperation.m&&............\..................\..................\AFResumingDownload-Info.plist&&............\..................\..................\AFResumingDownload-Prefix.pch&&............\..................\..................\AFURLConnectionOperation.h&&............\..................\..................\AFURLConnectionOperation.m&&............\..................\..................\AFXMLRequestOperation.h&&............\..................\..................\AFXMLRequestOperation.m&&............\..................\..................\AppDelegate.h&&............\..................\..................\AppDelegate.m&&............\..................\..................\AudioPlayer.h&&............\..................\..................\AudioPlayer.m&&............\..................\..................\AudioStreamer.h&&............\..................\..................\AudioStreamer.m&&............\..................\..................\CHANGES&&............\..................\..................\en.lproj\InfoPlist.strings&&............\..................\..................\icon.png&&............\..................\..................\main.m&&............\..................\..................\README.md&&............\..................\..................\UIImageView+AFNetworking.h&&............\..................\..................\UIImageView+AFNetworking.m&&............\..................\..................\ViewController.h&&............\..................\..................\ViewController.m
&近期下载过的用户:
&相关搜索:
&输入关键字,在本站238万海量源码库中尽情搜索:
&[] - ipad弹出框,点击弹出框中按钮在弹出一个弹出框,手动管理内存,
&[] - 基于ASIHttpRequest 网络框架实现,可以实现多个任务同时下载,断点续传等功能 ,用于ios客户端下载功能实现
&[] - 演示iOS中FTP的使用方法及调用流程 ,便于理解ios中sock通讯的流程2888人阅读
1.很多初学者,在每处用到网络请求的地方会直接拿afn实例去请求,从而带来了后续难以维护代码的问题
[[AFHTTPSessionManager manager] POST:nil parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
} failure:^(NSURLSessionDataTask *task, NSError *error) {
思考:如果afn不更新了,后续出现重大bug适配问题,从而导致每处用到afn的地方都要修改,请问怎么办?
***:呵呵,只能一个个修改了!有人会说,怎么可能不更新,很多人用着呢,怕什么。那假设其他第三方也同样出现类型的问题呢?所以是不是应该有方法或某种思想去解决呢?
解决方法:写个网络基类HRHttpBase,提供两个方法:GET 与 POST,外面请求时,直接调用这两个方法,万一afn出了问题,只要修改这两个方法即可,从而减轻后续维护成本!这种做法同样适用于其他的第三方库, 这也是一种开发思想。
HRHttpBase.h
HRHttpBase.m
假设业务复杂的话,如登录,涉及到第三方登录之类的,有比较多的网络请求,可以专门抽一个网络请求类要处理:
HRhttpLogin.h
HRhttpLogin.m
2.用到CocoaPods,但更改了afn代码问题
这是缺少text/html解析格式,请求网络时,只要添加上就行了,很多人在网上找到设置的地方(如下图)。但他忘了,项目用CocoaPods管理第三方库的,如果项目上线之前,同事更新了CocoaPods那么之前写的代码就没了!
解决办法:通过AFHTTPSessionManager实例找到AFHTTPResponseSerializer 对象,然后看有没提供对应的方法或属性可设置该格式。
像类似的网络请求header和user-agent都应该在自己的代码里设置!
3.返回字符串而并非是json或xml格式,怎么解析?
开发中确实是存在奇葩的需求,还有可能返回一堆html格式的String,要截取Sting里的某个key。对于处理不了的格式,afn有可能error回调。
用AFHTTPSessionManager,我没找到未解析的字符(知道的朋友可以告诉我,谢谢)。最后还是用了AFHTTPRequestOperationManager
operation.responseString即为未格式化的字符
Paste_Image.png
ps:如果朋友们还有些奇怪的问题,可以回复我,一起解决!
文/汉斯哈哈哈(简书作者)
原文链接:/p/3
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:197066次
积分:4554
积分:4554
排名:第7292名
原创:271篇
评论:20条
(2)(3)(3)(5)(1)(1)(1)(2)(4)(6)(17)(1)(5)(17)(4)(2)(9)(49)(12)(16)(33)(12)(9)(20)(15)(22)
(window.slotbydup = window.slotbydup || []).push({
id: '4740887',
container: s,
size: '250,250',
display: 'inlay-fix'