Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think Eugene's reply in this thread is properly describing the problem; after some testing, here is what I've concluded seems to be going on, with hopefully some details to help others stuck with this issue:</p> <p>Redirecting URLs will periodically cause failures. This happens both in the sync and async usages of <code>NSURLConnection</code>. I've created a test project to track down this bug, and this crash will consistently occur (typically between 25-500 iterations). Running the same test on 10.5.6 or without redirecting URLs does not fail (have run it up to 20,000 iterations).</p> <p>There are two possible work-arounds:</p> <ol> <li>Don't use redirecting URLs:<br> Obviously this isn't always possible, but if it is a known URL, you can still use the simple calls (like <code>stringWithContentsOfURL:</code>) and this will work fine. Dennis, in your case, the proper server URL is <code>download.finance.yahoo.com</code>, not <code>finance.yahoo.com</code>, so I believe this would fix your particular problem. Using <code>curl</code> you can see that you get a 301 redirect when you hit the latter address.</li> <li>Use the async calls and implement <code>connection:willSendRequest:redirectResponse:</code><br> If you implement even the most basic handling of this delegate method, everything seems to work. If you leave out this call (and thus let the system use its default implementation), you'll get the crash. For a basic implementation, just return the request that is passed in: </li> </ol> <pre><code>- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *) redirectResponse { return request; } </code></pre> <p>All of this seems to suggest to me that there is something broken in Apple's implementation in 10.5.7, but if anyone else has any insights as to what might be going on, please chime in. </p> <p>I have submitted a bug with my test project to Apple as <code>rdar://6936109</code> and referenced tjw's report (Radar 6932684).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload