ASIHTTPRequest fails in production builds

耗尽温柔 提交于 2019-12-29 03:34:05

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/9123975/asihttprequest-fails-in-production-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!