Flash Bazbo
Flash Bazbo

Reputation: 1

NSURLConnectionDelegate object losing delegate value

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?

Upvotes: 0

Views: 37

Answers (1)

Flash Bazbo
Flash Bazbo

Reputation: 1

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.

Upvotes: 0

Related Questions