ASIHTTPRequest 详解, http 请求终结者

详解iOS – ASIHTTPRequest 网络请求 前言 使用 iOS SDK 中的 HTTP 网络请求 API,相当的复杂,调用很繁琐,ASIHTTPRequest 就是一个对 CFNetwork API 进行了封装,并且使用起来非常简单的一套 API,外号 “HTTP终结者”,用 Objective-C 编写,运行效率很高,可以很好的应用在 Mac OS X 系统和 iOS 平台的应用程序中,ASIHTTPRequest 适用于基本的 HTTP 请求,和基于 REST 的服务之间的交互。可惜作者早已停止更新,有一些潜在的 BUG 无人去解决,很多公司的旧项目里面都残留着它的身影,以前的很多 iOS 项目都是 ASI + SBJson,会不 立即下载
http://wiki.magiche.net/pages/viewpage.action?pageId=2064410
ASIHTTPRequest 详解, http 请求终结者
目录

ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。让简单的API完成复杂的功能,

如:
异步请求,队列请求,GZIP压缩,缓存,断点续传,进度跟踪,上传文件,HTTP认证
在新的版本中,还加入了Objective-C闭包Block的支持,让我们的代码更加轻简灵活。

下面就举例说明它的API用法。

发起一个同步请求

同步意为着线程阻塞,在主线程中使用此方法会使应用Hang住而不响应任何用户事件。所以,在应用程序设计时,大多被用在专门的子线程增加用户体验,或用异步请求代替(下面会讲到)。

- (IBAction)grabURL:(id)sender
{
   NSURL *url = [NSURL URLWithString:@ "<a href="http://allseeing-i.com/" "="" style="border-top-left-radius: 0px 0px !important; border-top-right-radius: 0px 0px !important; border-bottom-right-radius: 0px 0px !important; border-bottom-left-radius: 0px 0px !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.2em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; outline-width: initial; outline-style: none; outline-color: initial; overflow-x: visible !important; overflow-y: visible !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; color: rgb(0, 51, 102) !important; text-decoration: none; background-position: initial initial !important; background-repeat: initial initial !important; ">http://allseeing-i.com" ];
   ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
   [request startSynchronous];
   NSError *error = [request error];
   if (!error) {
     NSString *response = [request responseString];
   }
}

a, 用requestWithURL快捷方法获取ASIHTTPRequest的一个实例
b, startSynchronous 方法启动同步访问,
c, 由于是同步请求,没有基于事件的回调方法,所以从request的error属性获取错误信息。
d, responseString,为请求的返回NSString信息。

创建一个异步请求

异步请求的好处是不阻塞当前线程,但相对于同步请求略为复杂,至少要添加两个回调方法来获取异步事件。
下面异步请求代码完成上面同样的一件事情:

- (IBAction)grabURLInBackground:(id)sender
{
    NSURL *url = [NSURL URLWithString:@ "<a href="http://allseeing-i.com/" "="" style="border-top-left-radius: 0px 0px !important; border-top-right-radius: 0px 0px !important; border-bottom-right-radius: 0px 0px !important; border-bottom-left-radius: 0px 0px !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.2em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; outline-width: initial; outline-style: none; outline-color: initial; overflow-x: visible !important; overflow-y: visible !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; color: rgb(0, 51, 102) !important; text-decoration: none; background-position: initial initial !important; background-repeat: initial initial !important; ">http://allseeing-i.com" ];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];
    [request startAsynchronous];
}
 
- ( void )requestFinished:(ASIHTTPRequest *)request
{
    // Use when fetching text data
    NSString *responseString = [request responseString];
 
    // Use when fetching binary data
    NSData *responseData = [request responseData];
}
 
- ( void )requestFailed:(ASIHTTPRequest *)request
{
    NSError *error = [request error];
}

a,与上面不同的地方是指定了一个 "delegate",并用startAsynchronous来启动网络请求。
b,在这里实现了两个delegate的方法,当数据请求成功时会调用requestFinished,请求失败时(如网络问题或服务器内部错误)会调用requestFailed。

队列请求

提供了一个对异步请求更加精准丰富的控制。
如,可以设置在队列中,同步请求的连接数。往队列里添加的请求实例数大于maxConcurrentOperationCount时,请求实例将被置为等待,直到前面至少有一个请求完成并出列才被放到队列里执行。
也适用于当我们有多个请求需求按顺序执行的时候(可能是业务上的需要,也可能是软件上的调优),仅仅需要把maxConcurrentOperationCount设为“1”。

- (IBAction)grabURLInTheBackground:(id)sender
{
    if (![self queue]) {
       [self setQueue:[[[NSOperationQueue alloc] init] autorelease]];
    }
 
    NSURL *url = [NSURL URLWithString:@ "<a href="http://allseeing-i.com/" "="" style="border-top-left-radius: 0px 0px !important; border-top-right-radius: 0px 0px !important; border-bottom-right-radius: 0px 0px !important; border-bottom-left-radius: 0px 0px !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.2em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; outline-width: initial; outline-style: none; outline-color: initial; overflow-x: visible !important; overflow-y: visible !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; color: rgb(0, 51, 102) !important; text-decoration: none; background-position: initial initial !important; background-repeat: initial initial !important; ">http://allseeing-i.com" ];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];
    [request setDidFinishSelector: @selector (requestDone:)];
    [request setDidFailSelector: @selector (requestWentWrong:)];
    [[self queue] addOperation:request]; //queue is an NSOperationQueue
}
 
- ( void )requestDone:(ASIHTTPRequest *)request
{
    NSString *response = [request responseString];
}
 
- ( void )requestWentWrong:(ASIHTTPRequest *)request
{
    NSError *error = [request error];
}

创建NSOperationQueue,这个Cocoa架构的执行任务(NSOperation)的任务队列。我们通过ASIHTTPRequest.h的源码可以看到,此类本身就是一个NSOperation的子类。也就是说它可以直接被放到"任务队列"中,并被执行。上面的代码队了队列的创建与添加操作外,其它代码与上一例一样。

请求队列上下文

a,可以设置一个上下文(userInfo)到request对象中,当请求响应完后可以通过访问request对象的userInfo获取里面的信息
b,为每一个请求实例设置不同的setDidFinishSelector / setDidFailSelector的回调方法
c,子类化ASIHTTPRequest,重写requestFinished: 与 failWithProblem:方法

ASINetworkQueues, 它的delegate提供更为丰富的功能

提供的更多的回调方法如下:
a,requestDidStartSelector,请求发起时会调此方法,你可以在此方法中跟据业务选择性的设置request对象的deleaget。
b,requestDidReceiveResponseHeadersSelector,当接受完响应的Header后设计此方法,这个对下载大数据的时候相当有用,你可以在方法里做更多业务上的处理。
c,requestDidFinishSelector,请求并响应成功完成时调用此方法
d,requestDidFailSelector,请求失败
e,queueDidFinishSelector,整个队列里的所有请求都结束时调用此方法。

它是NSOperationQueues的扩展,小而强大。但也与它的父类略有区别。如,仅添加到队列中其实并不能执行请求,只有调用[ queue g o]才会执行;一个正在运行中的队列,并不需要重复调用[ queue go ]。

默认情况下,队列中的一个请求如果失败,它会取消所有未完成的请求。可以设置[ queue setShouldCancelAllRequestsOnFailure:NO ]来修 正。

取消异步请求

首先,同步请求是不能取消的。
其次,不管是队列请求,还是简单的异步请求,全部调用[ request cancel ]来取消请求。

取消的请求默认都会按请求失败处理,并调用请求失败delegate。
如果不想调用delegate方法,则设置:[ request clearDelegatesAndCancel];

队列请求中需要注意的是,如果你取消了一个请求,队列会自动取消其它所有请求。
如果只想取消一个请求,可以设置队列:[ queue setShouldCancelAllRequestsOnFailure:NO ];
如果想明确取消所有请求:[ queue cancelAllOperations ];

安全的内存回收建议

request并没有retain你的delegate,所以在没有请求完的时候释放了此delegate,需要在dealloc方法里先取消所有请求,再释放请求实例,如:

- ( void )dealloc
{
    [request clearDelegatesAndCancel];
    [request release];
    ...
    [ super dealloc];
}
向服务器端上传数据

ASIFormDataRequest ,模拟 Form表单提交,其提交格式与 Header会自动识别。
没有文件:application/x-www-form-urlencoded
有文件:multipart/form-data

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@ "Ben" forKey:@ "first_name" ];
[request setPostValue:@ "Copsey" forKey:@ "last_name" ];
[request setFile:@ "/Users/ben/Desktop/ben.jpg" forKey:@ "photo" ];
[request addData:imageData withFileName:@ "george.jpg" andContentType:@ "image/jpeg" forKey:@ "photos" ];

如果要发送自定义数据:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request appendPostData:[@ "This is my data" dataUsingEncoding:NSUTF8StringEncoding]];
// Default becomes POST when you use appendPostData: / appendPostDataFromFile: / setPostBody:
[request setRequestMethod:@ "PUT" ];
下载文件

通过设置request的setDownloadDestinationPath,可以设置下载文件用的下载目标目录。
首先,下载过程文件会保存在temporaryFileDownloadPath目录下。如果下载完成会做以下事情:
1,如果数据是压缩的,进行解压,并把文件放在downloadDestinationPath目录中,临时文件被删除
2,如果下载失败,临时文件被直接移到downloadDestinationPath目录,并替换同名文件。

如果你想获取下载中的所有数据,可以实现delegate中的request:didReceiveData:方法。但如果你实现了这个方法,request在下载完后,request并不把文件放在downloadDestinationPath中,需要手工处理。

获取响应信息

信息:status , header, responseEncoding

[request responseStatusCode];
[[request responseHeaders] objectForKey:@ "X-Powered-By" ];
  [request responseEncoding];
获取请求进度

有两个回调方法可以获取请求进度,
1,downloadProgressDelegate,可以获取下载进度
2,uploadProgressDelegate,可以获取上传进度

cookie的支持

如果Cookie存在的话,会把这些信息放在NSHTTPCookieStorage容器中共享,并供下次使用。
你可以用[ ASIHTTPRequest setSessionCookies:nil ] ; 清空所有Cookies。
当然,你也可以取消默认的Cookie策略,而使自定义的Cookie:

//Create a cookie
NSDictionary *properties = [[[NSMutableDictionary alloc] init] autorelease];
[properties setValue:[@ "Test Value" encodedCookieValue] forKey:NSHTTPCookieValue];
[properties setValue:@ "ASIHTTPRequestTestCookie" forKey:NSHTTPCookieName];
[properties setValue:@ ".allseeing-i.com" forKey:NSHTTPCookieDomain];
[properties setValue:[NSDate dateWithTimeIntervalSinceNow: 60 * 60 ] forKey:NSHTTPCookieExpires];
[properties setValue:@ "/asi-http-request/tests" forKey:NSHTTPCookiePath];
NSHTTPCookie *cookie = [[[NSHTTPCookie alloc] initWithProperties:properties] autorelease];
 
//This url will return the value of the 'ASIHTTPRequestTestCookie' cookie
url = [NSURL URLWithString:@ "<a href="http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie" "="" style="border-top-left-radius: 0px 0px !important; border-top-right-radius: 0px 0px !important; border-bottom-right-radius: 0px 0px !important; border-bottom-left-radius: 0px 0px !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.2em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; outline-width: initial; outline-style: none; outline-color: initial; overflow-x: visible !important; overflow-y: visible !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; color: rgb(0, 51, 102) !important; text-decoration: none; background-position: initial initial !important; background-repeat: initial initial !important; ">http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie" ];
request = [ASIHTTPRequest requestWithURL:url];
[request setUseCookiePersistence:NO];
[request setRequestCookies:[NSMutableArray arrayWithObject:cookie]];
[request startSynchronous];
 
//Should be: I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'
NSLog(@ "%@" ,[request responseString]);
大文件断点续传

0.94以后支持大文件的断点下载,只需要设置:
[ request setAllowResumeForFileDownloads:YES ];
[ request setDownloadDestinationPath:downloadPath ];
就可以了。

ASIHTTPRequest会自动保存访问过的URL信息,并备之后用。在以下几个场景非常有用:
1,当没有网络连接的时候。
2,已下载的数据再次请求时,仅当它与本地版本不样时才进行下载。

ASIDownloadCache 设置下载缓存

它对Get请求的响应数据进行缓存(被缓存的数据必需是成功的200请求):

[ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];

当设置缓存策略后,所有的请求都被自动的缓存起来。
另外,如果仅仅希望某次请求使用缓存操作,也可以这样使用:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
多种的缓存并存

仅仅需要创建不同的ASIDownloadCache,并设置缓存所使用的路径,并设置到需要使用的request实例中:

ASIDownloadCache *cache = [[[ASIDownloadCache alloc] init] autorelease];
[cache setStoragePath:@ "/Users/ben/Documents/Cached-Downloads" ];
[self setMyCache:cache];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadCache:[self myCache]];
缓存策略

缓存策略是我们控制缓存行为的主要方式,如:什么时候进行缓存,缓存数据的利用方式。
以下是策略可选列表(可组合使用):

ASIUseDefaultCachePolicy 这是一个默认的缓存策略“ASIAskServerIfModifiedWhenStaleCachePolicy”,这个很明白,见名知意(它不能与其它策略组合使用)
ASIDoNotReadFromCacheCachePolicy 所读数据不使用缓存
ASIDoNotWriteToCacheCachePolicy 不对缓存数据进行写操作
ASIAskServerIfModifiedWhenStaleCachePolicy 默认缓存行为,request会先判断是否存在缓存数据。a, 如果没有再进行网络请求。 b,如果存在缓存数据,并且数据没有过期,则使用缓存。c,如果存在缓存数据,但已经过期,request会先进行网络请求,判断服务器版本与本地版本是否一样,如果一样,则使用缓存。如果服务器有新版本,会进行网络请求,并更新本地缓存
ASIAskServerIfModifiedCachePolicy 与默认缓存大致一样,区别仅是每次请求都会 去服务器判断是否有更新
ASIOnlyLoadIfNotCachedCachePolicy 如果有缓存在本地,不管其过期与否,总会拿来使用
ASIDontLoadCachePolicy 仅当有缓存的时候才会被正确执行,如果没有缓存,request将被取消(没有错误信息)
ASIFallbackToCacheIfLoadFailsCachePolicy 这个选项经常被用来与其它选项组合使用。请求失败时,如果有缓存当网络则返回本地缓存信息(这个在处理异常时非常有用)
如果设置了“defaultCachePolicy”则所有的请求都会使用此缓存。
缓存存储方式

你可以设置缓存的数据需要保存多长时间,ASIHTTPRequest提供了两种策略:
a,ASICacheForSessionDurationCacheStoragePolicy,默认策略,基于session的缓存数据存储。当下次运行或[ASIHTTPRequest clearSession]时,缓存将失效。
b,ASICachePermanentlyCacheStoragePolicy,把缓存数据永久保存在本地,
如:

ASIHTTPRequest *request = [ ASIHTTPRequest requestWithURL:url ];
[ request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy ];

另外,也可以使用clearCachedResponsesForStoragePolicy来清空指定策略下的缓存数据。

缓存其它特性

设置是否按服务器在Header里指定的是否可被缓存或过期策略进行缓存:

[[ ASIDownloadCache sharedCache ] setShouldRespectCacheControlHeaders:NO ];

设置request缓存的有效时间:

[ request setSecondsToCache: 60 * 60 * 24 * 30 ]; // 缓存30天

可以判断数据是否从缓存读取:

[ request didUseCachedResponse ];

设置缓存所使用的路径:

[ request setDownloadDestinationPath:[[ ASIDownloadCache sharedCache ] pathToStoreCachedResponseDataForRequest:request ]];
实现自定义的缓存

只要简单的实现ASICacheDelegate接口就可以被用来使用。

使用代理请求

默认的情况下,ASIHTTPRequest会使用被设置的默认代理。但你也可以手动修改http代理:

// Configure a proxy server manually
NSURL *url = [ NSURL URLWithString:@ "<a href="http://allseeing-i.com/ignore" "="" style="border-top-left-radius: 0px 0px !important; border-top-right-radius: 0px 0px !important; border-bottom-right-radius: 0px 0px !important; border-bottom-left-radius: 0px 0px !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.2em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; outline-width: initial; outline-style: none; outline-color: initial; overflow-x: visible !important; overflow-y: visible !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; color: rgb(0, 51, 102) !important; text-decoration: none; background-position: initial initial !important; background-repeat: initial initial !important; ">http://allseeing-i.com/ignore" ];
ASIHTTPRequest *request = [ ASIHTTPRequest requestWithURL:url ];
[ request setProxyHost:@ "192.168.0.1" ];
[ request setProxyPort: 3128 ];
 
// Alternatively, you can use a manually-specified Proxy Auto Config file (PAC)
// (It's probably best if you use a local file)
[request setPACurl:[NSURL URLWithString:@ "file:///Users/ben/Desktop/test.pac" ]];
ASIHTTPRequest, 请求的其它特性

iOS4中,当应用后台运行时仍然请求数据:

[ request setShouldContinueWhenAppEntersBackground:YES ];

是否有网络请求:

[ ASIHTTPRequest isNetworkInUse ]

是否显示网络请求信息在status bar上:

[ ASIHTTPRequest setShouldUpdateNetworkActivityIndicator:NO ];

设置请求超时时,设置重试的次数:

[ request setNumberOfTimesToRetryOnTimeout: 2 ];

KeepAlive的支持:

// Set the amount of time to hang on to a persistent connection before it should expire to 2 minutes
[ request setPersistentConnectionTimeoutSeconds: 120 ];
 
// Disable persistent connections entirely
[ request setShouldAttemptPersistentConnection:NO ];

版权归旺财勇士所有〜转载需声名〜

LC整流滤波电路DIY:电感电容配合,手把手搭建低纹波直流电源 在直流电源设计中,整流滤波是连接交流输入与稳定输出的关键环节。常见的电容滤波虽然简单,但在大负载下纹波抑制能力有限,电感抵抗电流突变、电容抵抗电压突变,二者组合构成的LC滤波能有效降低输出电压纹波,同时减小开机浪涌电流。在工频线性电源、功放电源等对噪声敏感的场景中,LC滤波常作为稳压前的平滑缓冲。本文以一套完整DIY项目为线索,介绍整流桥后串联功率电感、并联滤波电容的电路构成,结合实际计算与波形测试,讨论电感量估算、电容选取、谐振风险、饱和电流等工程问题,并给出上电测试和故障排查方法。通过搭建与调试,可直观 阅读详情

相关推荐

nnDetection复现Luna16 附模型

淘论文发现nnDetection框架对肺结节的检测效果挺好,便跑了跑复现了下, 作者诚不欺人,确实挺好, 并附上我依据文档训练的模型。

HeavenWalker 2597

ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。

  ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。让简单的API完成复杂的功能, 如:异步请求,队列请求,GZIP压缩,缓存,断点续传,进度跟踪,上传文件,HTTP认证在新的版本中,还加入了Objective-C闭包Block的支持,让我们的代码更加轻简灵活。 下面就举例说明它的API用法。 发起一个同步请求同步意为着线程阻塞,在主线程中使用此方法会使应用Hang住而不...

既是过河之卒,惟有奋力向前。 330

独立游戏开发者的新武器:实测腾讯混元3D自动绑骨,搭配Mixamo让角色动画制作效率翻倍

本文实测腾讯混元3D自动绑骨功能与Mixamo动画库的协同使用,显著提升独立游戏开发者的角色动画制作效率。通过解决卡通角色绑骨偏差、优化骨骼权重及动画状态机配置,使原本两周的流程缩短至三天,并分享Unity中的性能优化与版权合规要点。

weixin_42662605的博客 491

ASIHTTPRequest 简介/使用详解

ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台的应用程序中。ASIHTTPRequest适用于基本的HTTP请求,和基于REST的服务之间的交互 l 通过简单的接口,即可完成向服务端提交数据和从服务端获取数据的工作 l 下载的数据,可存储

Clarence 819

UniTouch:多模态触觉对齐技术如何重塑零样本跨模态应用

UniTouch模型通过创新的多模态触觉对齐技术,成功将触觉数据映射到通用的视觉-语言嵌入空间,解决了触觉模态的“孤岛困境”。该技术利用对比学习和传感器特定标记,实现了高质量的零样本学习能力,使模型无需额外训练即可完成触觉分类、描述等任务,并能驱动跨模态生成,为机器人、VR和智能制造等领域提供了强大的触觉理解新范式。

weixin_29044713的博客 409

Vivado安装教程:多版本共存的配置技巧

详解Vivado安装教程中的多版本共存配置技巧,帮助用户在同一系统中管理不同版本的Vivado开发环境,提升开发效率与兼容性,适用于需要切换版本的FPGA开发者。

weixin_35257663的博客 1774

第三方苹果开发库之ASIHTTPRequest(翻译版)

来自:http://www.dreamingwish.com/dream-2011/apples-third-party-development-libraries-asihttprequest.html 第三方苹果开发库之ASIHTTPRequest ASIHttpRequest库简介、配置和安装 ASIHttpRequest-创建和执行request AS...

weixin_30878361的博客 328

CentOS7下快速修复libssl.so.1.1缺失问题(附腾讯云镜像加速下载)

本文详细介绍了在CentOS7系统中快速修复libssl.so.1.1缺失问题的工程化实践方案。通过编译安装OpenSSL 1.1.x版本、配置动态链接器及创建符号链接等步骤,有效解决共享对象文件缺失问题,并提供了腾讯云镜像加速下载的优化方案,帮助开发者高效部署现代应用。

weixin_33711647的博客 367

ASIHTTPRequest类库简介和使用说明

官方网站: http://allseeing-i.com/ASIHTTPRequest/ 。可以从上面下载到最新源码,以及获取到相关的资料。 使用iOS SDK中的HTTP网络请求API,相当的复杂,调用很繁琐,ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台...

weixin_34336526的博客 274

Verilog仿真时读取bin文件模拟输入数据流,将输出数据流写入bin文件

需要关注的是,一般会省略文件起始地址和读取长度,那么mem为多大,就会从文件中读取多大的数据出来填充mem。如果只需要读取一次文件,那么代码到此就结束了,但是如果还需要每一帧都读取该文件转换为数据流,则在循环里判断新的一帧信号是否到来,在新的一帧再次打开一次文件,从头开始读取数据。

qq_41137205的博客 2772

Windows 11“此应用已被管理员阻止运行”解决方案

通过本文介绍的两种方法,你应该能够解决Windows 11中“此应用已被管理员阻止运行”的问题。无论你选择创建新管理员账户还是禁用管理员批准模式,都请确保了解相关操作的风险,并根据你的实际需求做出选择。通过禁用“用户账户控制:以管理员批准模式运行所有管理员”设置,可以解决因系统安全设置导致的应用程序被阻止运行的问题。这种方法适用于那些希望简化管理员账户操作流程的用户,但需要注意可能带来的安全风险。通过创建并登录具有管理员权限的新账户,可以解决因系统安全设置导致的应用程序被阻止运行的问题。

mmoo_python的博客 1万+

IOS开发:ASIHTTPRequest中HTTP请求终结者详解

IOS开发:ASIHTTPRequest中HTTP请求终结者详解 IOS开发中ASIHTTPRequest里HTTP请求终结者详解是本文要介绍的内容,主要是来学习IOS开发中请求同步的问题。今天把这个的官方文档翻译的出来以做分享,让迷途之人有路可寻.具体内容来考哪本文详细内容讲解。 ASIHTTPRequest是一款极其强劲的HTTP访问开源项目。让简单的API完成复杂的功能, 如:

zhenweicao的专栏 3350

在Windows 10/11上使用Qt和SOEM构建EtherCAT主站:工业控制新纪元

☑️ Windows平台上的EtherCAT主站☑️ 微秒级精度的实时控制☑️ 动态设备配置与管理☑️ 直观的Qt监控界面☑️ 分布式时钟同步“技术不是取代人类的工具,而是拓展人类能力的翅膀。当我们在Windows上实现微秒级精度的工业控制时,不是在征服机器,而是在创造人与机器和谐共舞的新舞台。集成AI异常检测算法支持EtherCAT G协议云端监控与远程诊断完整项目代码预编译SOEM库示例视频教程。

QQ_778132974的博客 633

ASIHTTPRequest 详解, http 请求终结者2

安全的内存回收建议request并没有retain你的delegate,所以在没有请求完的时候释放了此delegate,需要在dealloc方法里先取消所有请求,再释放请求实例,如: 复制代码 - (void)dealloc { [request clearDelegatesAndCancel]; [request releas...

anhe8044的博客 168

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

上一篇: iphone 图片拉伸不变形的方法
下一篇: 子线程在后台运行: performSelectorInBackground
think12
博客等级 码龄17年 132粉丝 173原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值