My application crashes as soon as I call [[ASIHTTPRequest alloc] initWithURL:url]; on my iPod Touch 1G. It has no issue on iOS 4.x.
The error I see is Error Domain=ASIHTTPRequestErrorDomain Code=10 UserInfo=0x368790 "NSRangeException"
and the backtrace I get from a crash manager system I have implemented is
backtrace: (
"0 MayasDUp 0x0007f21b -[SWCrashManager backtrace] 开发者_StackOverflow+ 18",
"1 MayasDUp 0x0007ece1 sighandler + 144",
"2 libSystem.B.dylib 0x3049e7eb _sigtramp + 26",
"3 MayasDUp 0x0005128b -[ASIHTTPRequest buildPostBody] + 850"
)
I even placed the [[ASIHTTPRequest alloc] initWithURL:url] call alone, without performing anything else like setting post variables and starting the connection. The crash still happens.
I've placed breakpoints and log NSLogs inside ASIHTTPRequest but nothing useful came out.
Has anyone had a similar issue?
After much digging, I found that the issue was very deep and it actually was a compiler bug.
In short, using LLVM 2.0 and setting Optimization Level > None for the project resulted in corrupted compiled files (ASIHTTPRequest and ASIFormDataRequest) which caused the crash and provided no real data in the stack trace.
The solution we applied was to leave Compiler and Optimization settings intact and add a -O0 compiler flag for the 2 ASIHttp files that had the issue.
Other users reported that XCode 4.0.2 fixed the compiler issue.
For anyone interested, there are some details here: http://groups.google.com/group/asihttprequest/browse_thread/thread/c598649bfe71643c/8ee09defd12386ba?lnk=gst&q=crashes#8ee09defd12386ba
You probably have something running on the main thread that is taking over 10 seconds. Are you doing synchronous http requests? You must use:
[request startAsynchronous];
if you're on the main thread.
精彩评论