ASIHTTPRequest在生产版本中失败

ASIHTTPRequest在生产版本中失败

本文介绍了ASIHTTPRequest在生产版本中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我遇到了一个很大的问题。似乎ASIHTTPRequest只是不想在生产版本中工作。

一切都在调试中很好用。但是,一旦我为生产构建,以下代码就不想运行。它既不会阻止块完成也不会失败。
我也试过使用选择器,有一个委托,但那些也没有被调用。

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?

推荐答案

看起来ASIHttpRequest中存在一个错误,在使用发布模式优化运行时导致此崩溃。

It looks like there's a bug in ASIHttpRequest, causing this crash when running with Release mode optimizations.

对我有用的是关闭以下2个文件的优化:
ASIFormDataRequest.m
ASIHTTPRequest.m

What worked for me is turning off optimization for the following 2 files:ASIFormDataRequest.mASIHTTPRequest.m

通过选择目标项目来执行此操作,在构建阶段选项卡的编译
源部分中选择该文件;并添加-O0(国会大厦O零)。

Do this by selecting the target project, select the file in "Compilesources" section of the "Build Phases" tab; and add -O0 (capitol O zero).

您可以阅读更多相关信息

You can read more about it here

这篇关于ASIHTTPRequest在生产版本中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:15