So i've run into quite a problem. It seems that ASIHTTPRequest just does not want to work in a production build.
Everything works great in debug. However, once I build for production the following code just doesn't want to run. It doesn't hit either block complete nor failed.
I have also tried using selectors, with a delegate but those do not get called either.
__block __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:URL];
[self performSelectorOnMainThread:@selector(startSpinner) withObject:nil waitUntilDone:NO];
[request setCompletionBlock:^{
[self performSelectorOnMainThread:@selector(stopSpinner) withObject:nil waitUntilDone:NO];
}];
[request setFailedBlock:^{
[self performSelectorOnMainThread:@selector(stopSpinner) withObject:nil waitUntilDone:NO];
}];
[request startAsynchronous];
I know it's kind of a bad description of my problem but does anyone have the slightest clue as to what could possibly cause this problem?
It looks like there's a bug in ASIHttpRequest, causing this crash when running with Release mode optimizations.
What worked for me is turning off optimization for the following 2 files: ASIFormDataRequest.m ASIHTTPRequest.m
Do this by selecting the target project, select the file in "Compile sources" section of the "Build Phases" tab; and add -O0 (capitol O zero).
You can read more about it here