在模拟器中,使用 ASIHTTPRequest 的 setCompletionBlock: 消息总是会导致 EXC_BAD_ACCESS 错误。即使将 NSZombieEnabled 设置为 YES 也无法说明情况。
__weak ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setCompletionBlock:^{
int statusCode = [request responseStatusCode];
NSLog(@"%d",statusCode);
}];
[request setFailedBlock:^{
// send statuscode error back
int statusCode = [request responseStatusCode];
NSLog(@"%d",statusCode);
}];
[request startAsynchronous];