RE: NSXMLParser bug?
RE: NSXMLParser bug?
- Subject: RE: NSXMLParser bug?
- From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
- Date: Thu, 11 Sep 2008 08:50:54 -0400
- Thread-topic: NSXMLParser bug?
I thought that all initializers had to call through the designated initializer, which means that init should be overridden to call
initWithData:. Am I wrong?
Thanks,
Cem Karan
-----Original Message-----
From: Graham Cox [mailto:email@hidden]
Sent: Thursday, September 11, 2008 8:19 AM
To: Karan, Cem (Civ, ARL/CISD)
Cc: email@hidden
Subject: Re: NSXMLParser bug?
On 11 Sep 2008, at 9:57 pm, Karan, Cem (Civ, ARL/CISD) wrote:
> Hi all, I wanted confirmation of this by someone else before I filed a
> useless bug report. I'm using NSXMLParser in a slightly non- standard
> way, just so I can slog through my unit tests quickly. I instantiate
> it like this:
>
> NSXMLParser *dummyParser = [[NSXMLParser alloc] init];
>
> Rather than use either initWithContentsOfURL: or initWithData:. My
> unit test runs fine right up until I go to release the parser; then
> they crash in NSXMLParser's dealloc method. Does anyone else see this
> as well? My test case code is now down to this:
>
> - (void) testParserDelegateMethods
> {
> NSXMLParser *dummyParser = [[NSXMLParser alloc] init];
> NSAssert(dummyParser != nil, @"Problem allocating parser");
> NSLog(@"Parser retain count = %u", [dummyParser retainCount]);
> [dummyParser release];
> }
from the docs:
initWithData:
[]
Discussion
This method is the designated initializer.
This means you *MUST* call this initializer when creating the object, directly or indirectly. I'm guessing that -init isn't
overridden to call this. Maybe you could pass an empty data object?
hth, Graham
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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