ASIHTTPRequest 在生产版本中失败 [英] ASIHTTPRequest fails in production builds
问题描述
所以我遇到了一个相当大的问题.似乎 ASIHTTPRequest 只是不想在生产版本中工作.
在调试中一切都很好.但是,一旦我为生产构建了以下代码就不想运行了.它既没有达到块完成也没有失败.我也尝试过使用带有委托的选择器,但它们也不会被调用.
__block __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:URL];[self performSelectorOnMainThread:@selector(startSpinner) withObject:nil waitUntilDone:NO];[请求 setCompletionBlock:^{[self performSelectorOnMainThread:@selector(stopSpinner) withObject:nil waitUntilDone:NO];}];[请求 setFailedBlock:^{[self performSelectorOnMainThread:@selector(stopSpinner) withObject:nil waitUntilDone:NO];}];[请求开始异步];
我知道这是对我的问题的一种糟糕的描述,但有没有人对可能导致此问题的原因有一点线索?
看起来 ASIHttpRequest 中存在错误,导致在使用 Release 模式优化运行时崩溃.
对我有用的是关闭以下 2 个文件的优化:ASIFormDataRequest.mASIHTTPRequest.m
通过选择目标项目来做到这一点,在编译构建阶段"选项卡的源"部分;并添加 -O0(国会大厦 O 零).
您可以在此处
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
这篇关于ASIHTTPRequest 在生产版本中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!