Re: Crash from NSURLConnection if delegate released too soon?
Re: Crash from NSURLConnection if delegate released too soon?
- Subject: Re: Crash from NSURLConnection if delegate released too soon?
- From: Roland King <email@hidden>
- Date: Tue, 26 Aug 2014 07:50:44 +0800
> On 26 Aug 2014, at 12:40 am, Howard Moon <email@hidden> wrote:
>
> Ok, I fixed it. I was using the connection object as a member of my class, and releasing that, when I should have been releasing the connection that is given to me inside didFailWithError and connectionDidFinishLoading, not making it a member at all.
>
> Regards,
> Howard
That didn’t sound quite right, either way Jens followed up with some rules which did sound right.
I’m not entirely sure this crash is down to you nor that it’s calling any methods on your correctly deallocated instance of NSURLConnection or the delegate. To me it looks like the HTTP cache subsystem is purging data and tripping over itself because of something it cleaned up when the NSURLConnection was closed earlier, perhaps a weak NSURL pointer it had to a temporary file which it nil’ed or similar, or a bug in the HTTP cache system when plugins using it are unloaded which yanks out data it’s going to access later.
Do you still get the crash if you change your cache policy? Not that you necessarily can change it for your app, just a question of trying to narrow down where the error is coming from. You could also perhaps implement some of the URL cacheing callbacks on the delegate to try and circumvent the OS trying to store data, not sure that has too much mileage in it.
This starts to look to me more like a framework bug than your own.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden