I have a weird behavior with NSURLConnection (still trying to have my
custom protocol to handle some HTTP GET behind the scene). So as Maciej
suggested I am investigating the used for NSURLConnection.
[snip]
And the implementation for the class TSCustomConnection is something
like :
- initURLConnectionWithRequest:(NSURLRequest *)request
{
[super init];
_request = [request retain];
_data = nil;
return self;
}
I don't know if this is causing your problems, but this init method is
not correct. In any init method where you call super, you should write
code like this:
- initBlahBlah....
{
if((self = [super init])) // can be initWithWhatever...
{
...assign ivars...
}
return self;
}
There are variations on this theme, but the important part is that you
always assign self to the return value of [super init] and you always
check it. It's completely possible that [super init] will release self
and return another object instead, or simply return nil to indicate
failure of some sort.
99% of the time, init returns the same thing you called it on, and so
this could very well not be causing any trouble, but it's still good
practice to follow for that other 1%.
--
"Hello," he lied.
-- Don Carpenter quoting a Hollywood agent