Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

ios - ASIHTTPRequest fails in production builds

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...