In the simulator, using ASIHTTPRequest's setCompletionBlock: message always causes an EXC_BAD_ACCESS error. Even setting NSZombieEnabled to YES does nothing to illuminate the situation.
__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];
Ok, so after spending 2 days, I finally found the solution: Fixing my linker flags
Essentially you have to change -weak_library /usr/lib/libSystem.B.dylib to -weak-lSystem.
I had originally added this because Urban Airship required it.
Many thanks to following References:
EXC_BAD_ACCESS when copying or retaining Block
iPhone simulators crash on app launch