NSURLConnectionDelegate object losing delegate value

38 views Asked by At

I have an NSURLConnectionDelegate object which has its own delegate pointing to some search result handler.

When the connection method gets called, the instance of the NSURLConnectionDelegate that is in the debugger has a zero value for the delegate instead of the value I set it to before the request!

I've verified it's the same object by verifying the address, but it doesn't contain the exact same state as before the request is sent. It's as if the object was serialized/deserialized and the delegate variable state wasn't recorded.

How can I debug this?

1

There are 1 answers

0
Flash Bazbo On

Turned out I just had to change the delegate property from weak to strong, though that might create a leak in the general case. The delegate must be getting freed earlier than anticipated, so need to add a longer lived reference elsewhere.