Hi,
I have this class in DNS.h
@interface DNS : NSObject <NSXMLParserDelegate, NSNetServiceDelegate> {
NSMutableArray *servsPublished;
}
@property(nonatomic, retain) NSMutableArray *servsPublished;
Then in the implementation file DNS.m there's a method where I release it and I get the exec bad access memory error. This is method, it conforms to the NSXMLParserDelegate protocol
-(void) parserDidEndDocument:(NSXMLParser *)parser {
NSNetService *client;
for (NSDictionary *aService in servToPublish) {
client = [[NSNetService alloc] initWithDomain:@"local"
type:[aService objectForKey:@"serviceType"]
name:[aService objectForKey:@"name"]
port: [(NSNumber *)[aService objectForKey:@"port"] intValue]];
[client setDelegate: self];
[client publish];
//release this service and the client
[aService release];
//[client release];
}
//free the array of Dictionary containing the services
[servToPublish release];
}
Maybe the first thought is that is nil, but actually I use it inside the method checking whether is nil or not, and then free it.
Does It have something to do with the retain property? THX.