asihttprequest post支持ipv6吗

迁移项目必然要遇到旧的库在新的环境下水土不服的情况,首先遇到的难题是ASIHttpRequest。
Stackoverflow上找到了一个答案,如下:
It's very easy to use asi-http-request in an ARC environment without changing anything, simply follow these steps:
Simply create a static library target.
Add asi-http-request files as required to the library target
Configure the target to build without ARC
Add that static library as a dependency to your app target
Add that static library in the build phases link section.
可能是我操作有问题没有解决,于是尝试着躲避ARC,就想到了干脆把不想用ARC的文件都加上个flag&-fno-objc-arc&
阅读(...) 评论()iphone - What is ASIHTTPRequest? - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
What is ASIHTTPRequest? how do we use it in an iphone application? what are the files we need to include? Does Apple provide files for this?
2,01712356
you will be able to know what is it and how to use it....it is use to get the request from the server and post request to server
Good Luck!
What is ASIHTTPRequest?
ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier. It is written in Objective-C and works in both Mac OS X and iPhone applications.
A (BSD licensed) wrapper to facilitate the use of CFNetwork. Commonly, it is used to deal with HTTP requests.
The documentation explains how to use it.
As ASIHTTPRequest is not an Apple product, Apple doesn't provide files for this.
This is what the
ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier. It is written in Objective-C and works in both Mac OS X and iPhone applications.
It is suitable performing basic HTTP requests and interacting with REST-based services (GET / POST / PUT / DELETE). The included ASIFormDataRequest subclass makes it easy to submit POST data and files using multipart/form-data.
Also, ASIHTTPRequest page says
Please note that I am no longer working on this library - you may want to consider using something else for new projects. :)
might be an alternative.
2,39011934
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled创建ASIHttpRequest.framework并启用支持ARC特性
1. 创建fake framework使用这个XCode Plugin: iOS-Universal-Framework&
& & 使用它可以直接创建静态库XXX.framework, 不需要太多复杂设置.
2. ASIHttpRequest的: ASIHTTPRequest
3. 通过以上Plugin创建 fake static iOS framework, 并在项目BuildSetting中搜索 automatic reference , 将 Objective-C Automatic Reference Counting 设为YES, 启动ARC特性.
4. 将ASIHTTPRequest的源码导入. 如果此时Build,会编译不通过的.
5. 打开TARGET的Build Phases, 找到Compile Sources,把里面的全部.m对应的Compiler Flags设置为 -fno-objc-arc&
6. Build即可,在Products里会生成对应的.framework
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'您所在的位置: &
iOS开发ASIHTTPRequest进度追踪
iOS开发ASIHTTPRequest进度追踪
dreamingwish
本文为大家介绍了发ASIHTTPRequest进度追踪的内容,其中包括追踪单个request的下载进度,追踪一系列request的下载进度,追踪单个request的上传进度,追踪一系列request的上传进度,精确进度条vs简单进度条,自定义进度追踪等等内容。
本文为大家介绍了发ASIHTTPRequest进度追踪的内容,其中包括追踪单个request的下载进度,追踪一系列request的下载进度,追踪单个request的上传进度,追踪一系列request的上传进度,精确进度条vs简单进度条,自定义进度追踪等等内容。
每个ASIHTTPRequest有两个delegate用来追踪进度:
downloadProgressDelegate (下载) 和 uploadProgressDelegate (上载)。
进度delegate可以是NSProgressIndicators (Mac OS X) 或者 UIProgressViews
(iPhone).ASIHTTPRequest会自适应这两个class的行为。你也可以使用自定义class作为进度delegate,只要它响应setProgress:函数。
如果你执行单个request,那么你需要为该request设定upload/download进度delegate
如果你在进行多个请求,并且你想要追踪整个队列中的进度,你必须使用ASINetworkQueue并设置队列的进度delegate
如果上述两者你想同时拥有,恭喜你,0.97版以后的ASIHTTPRequest,这个可以有 ^ ^
IMPORTANT:如果你向一个要求身份验证的网站上传数据,那么每次授权失败,上传进度条就会被重置为上一次的进度值。因此,当与需要授权的web服务器交互时,建议仅当useSessionPersistence为YES时才使用上传进度条,并且确保你在追踪大量数据的上传进度之前,先使用另外的request来进行授权。&
追踪小于128KB的数据上传进度目前无法做到,而对于大于128kb的数据,进度delegate不会收到第一个128kb数据块的进度信息。这是因为CFNetwork库API的限制。我们曾向apple提交过bug报告(bug
id 6596016),希望apple能修改CFNetwork库以便实现上述功能。
:Apple的哥们儿们真棒!iPhone 3.0
SDK里,buffer大小已经被减小到32KB了,我们的上传进度条可以更精确了。
追踪单个request的下载进度
这个例子中,&myProgressIndicator是个 NSProgressIndicator.
ASIHTTPRequest&*request&=&[ASIHTTPRequest&requestWithURL:url];&[request&setDownloadProgressDelegate:myProgressIndicator];&[request&startSynchronous];&NSLog(@&Max:&%f,&Value:&%f&,&[myProgressIndicator&maxValue],[myProgressIndicator&doubleValue]);&
追踪一系列request的下载进度
在这个例子中, myProgressIndicator 是个 UIProgressView, myQueue是个 ASINetworkQueue.
-&(void)fetchThisURLFiveTimes:(NSURL&*)url&{&&&&[myQueue&cancelAllOperations];&&&&[myQueue&setDownloadProgressDelegate:myProgressIndicator];&&&&[myQueue&setDelegate:self];&&&&[myQueue&setRequestDidFinishSelector:@selector(queueComplete:)];&&&&int&i;&&&&for&(i=0;&i&5;&i++)&{&&&&&&&ASIHTTPRequest&*request&=&[ASIHTTPRequest&requestWithURL:url];&&&&&&&[myQueue&addOperation:request];&&&&}&&&&[myQueue&go];&}&&&-&(void)queueComplete:(ASINetworkQueue&*)queue&{&&&&NSLog(@&Value:&%f&,&[myProgressIndicator&progress]);&}&
这个例子中,我们已经为ASINetworkQueues调用过[myQueue go]了。
追踪单个request的上传进度
在这个例子中, myProgressIndicator 是个 UIProgressView。
ASIFormDataRequest&*request&=&[ASIFormDataRequest&requestWithURL:url];&[request&setPostValue:@&Ben&&forKey:@&first_name&];&[request&setPostValue:@&Copsey&&forKey:@&last_name&];&[request&setUploadProgressDelegate:myProgressIndicator];&[request&startSynchronous];&NSLog(@&Value:&%f&,[myProgressIndicator&progress]);&
追踪一系列request的上传进度
这个例子中, myProgressIndicator是个 NSProgressIndicator,
myQueue是个ASINetworkQueue.
-&(void)uploadSomethingFiveTimes:(NSURL&*)url&{&&&&[myQueue&cancelAllOperations];&&&&[myQueue&setUploadProgressDelegate:myProgressIndicator];&&&&[myQueue&setDelegate:self];&&&&[myQueue&setRequestDidFinishSelector:@selector(queueComplete:)];&&&&int&i;&&&&for&(i=0;&i&5;&i++)&{&&&&&&&ASIHTTPRequest&*request&=&[ASIFormDataRequest&requestWithURL:url];&&&&&&&[request&setPostBody:[@&Some&data&&dataUsingEncoding:NSUTF8StringEncoding]];&&&&&&&[myQueue&addOperation:request];&&&&}&&&&[myQueue&go];&}&&&-&(void)queueComplete:(ASINetworkQueue&*)queue&{&&&&NSLog(@&Max:&%f,&Value:&%f&,&[myProgressIndicator&maxValue],[myProgressIndicator&doubleValue]);&}&
精确进度条vs简单进度条
ASIHTTPRequest提供两种进度条显示,简单进度条和精确进度条,使用ASIHTTPRequests
和ASINetworkQueues的showAccurateProgress
来控制。为一个request设置showAccurateProgress只会对该request有效。如果你为一个队列设置showAccurateProgress,那么会影响队列里所有的request。
简单进度条
当使用简单进度条时,进度条只会在一个request完成时才更新。对于单个request,这意味着你只有两个进度状态:0%和100%。对于一个有5个request的队列来说,有五个状态:0%,25%,50%,75%,100%,每个request完成时,进度条增长一次。
简单进度条(showAccurateProgress = NO)是ASINetworkQueue的默认值,适用于大量小数据请求。
精确进度条
当使用精确进度条时,每当字节被上传或下载时,进度条都会更新。它适用于上传/下载大块数据的请求,并且会更好的显示已经发送/接收的数据量。
使用精确进度条追踪上传会轻微降低界面效率,因为进度delegate(一般是UIProgressViews
或NSProgressIndicators)会更频繁地重绘。
使用精确进度条追踪下载会更影响界面效率,因为队列会先为每个GET型request进行HEAD请求,以便统计总下载量。强烈推荐对下载大文件的队列使用精确进度条,但是要避免对大量小数据请求使用精确进度条。
精确进度条(showAccurateProgress = YES)是以同步方式执行的ASIHTTPRequest的默认值。
自定义进度追踪
ASIProgressDelegate
协议定义了所有能更新一个request进度的方法。多数情况下,设置你的uploadProgressDelegate或者
downloadProgressDelegate为NSProgressIndicator或者UIProgressView会很好。但是,如果你想进行更复杂的追踪,你的进度delegate实现下列函数要比&setProgress:
(iOS) 或者 setDoubleValue: / setMaxValue: (Mac)好:
这些函数允许你在实际量的数据被上传或下载时更新进度,而非简单方法的0到1之间的数字。
downloadProgressDelegates方法
request:didReceiveBytes:&每次request下载了更多数据时,这个函数会被调用(注意,这个函数与一般的代理实现的&request:didReceiveData:函数不同)。
request:incrementDownloadSizeBy:&当下载的大小发生改变时,这个函数会被调用,传入的参数是你需要增加的大小。这通常发生在request收到响应头并且找到下载大小时。
uploadProgressDelegates方法
request:didSendBytes:&每次request可以发送更多数据时,这个函数会被调用。注意:当一个request需要消除上传进度时(通常是该request发送了一段数据,但是因为授权失败或者其他什么原因导致这段数据需要重发)这个函数会被传入一个小于零的数字。
【编辑推荐】
【责任编辑: TEL:(010)】
关于&&的更多文章
开发者在代码开发和维护中,往往会遇到很多代码优化和内存优化的
既然强大的Android Studio来了,有什么理由不去用呢?
对于设计师来说,扁平化设计是一种实打实的设计风格,
BYOD(Bring Your Own Device)指携带自己的设备办公
在Android开发中,优化,是一直困扰开发者的一个难题
本书全面翔实地介绍了各种病毒的原理,以操作系统的发展为主线,结合病毒的发展过程来综合分析病毒。在分析工具上,较多地利用了
Windows Phone专家
Android开发专家
51CTO旗下网站}

我要回帖

更多关于 asihttprequest arc 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信