tags:

views:

81

answers:

1

I have an iPhone app that downloads URLs. (PDFs to display) Easy:

self.request = [NSURLRequest requestWithURL:self.url];
self.conn = [NSURLConnection connectionWithRequest:self.request delegate:self];

where self.conn and request are retained properties.

For specific URLs, this throws EXC_BAD_ACCESS. The URL is valid and is constructed in the same way as URLs that do work. (90% of URLs are fine)

These ones work:

http://www.airservicesaustralia.com/publications/current/ersa/FAC_YARG_11-Mar-2010.pdf
http://www.airservicesaustralia.com/publications/current/ersa/FAC_YARK_11-Mar-2010.pdf

These don't:

http://www.airservicesaustralia.com/publications/current/ersa/FAC_YAMK_11-Mar-2010.pdf
http://www.airservicesaustralia.com/publications/current/ersa/FAC_YATN_11-Mar-2010.pdf

Spot the difference? Yeah, me neither. Also no difference in response headers from the server for them. To clarify, the ones that work ALWAYS work, the ones that don't NEVER work. So not some random release/retain issue it seems.

For the ones that don't work, none of the methods in my delegate are ever called, it fails hard before that. And with no error message, just EXC_BAD_ACCESS.

Sooo.... Any way to debug what is going on inside NSURLConnection?

A: 

OK - some thoughts:

Your URL's are NSURL's not strings right ? (I'm sure they are but worth a check)

When you say no delegate methods are called, are you checking connection:didReceiveResponse:

I'd guess that the error is nothing whatsoever to do with this code, and that just a minor difference in PDF size or something is causing the error.

As an alternative approach take a look as ASIHTTPRequest : it might just work where yours fails, for no good reason!

Andiih
Thanks, will look at ASIHTTPRequest.Definitely URLs and not strings. If they weren't URLs, all requests would fail all the time, not a specific few?Breakpoints and logging in all delegate methods. When the request fails, connection:didReceiveResponse is never called, so it fails before it gets to that point.
baswell