I am trying to copy a string that is passed to a method like this:
-(void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { NSLog( @"elementName, %@: %i", elementName, [elementName retainCount] );
setCurrenttag - synthesized accessor ( @property (copy) ). I realized that this would create a completely new object instead of just referencing elementName . The above behavior behaves as if it maintains a reference to elementName and causes persistence. The commented code bit shows the same behavior.
These methods implement the NSXMLParserDelegate protocol, but I need to track specific element names (but not all).
Is there anything I am missing regarding NSString objects and memory management on iphone.
Also, as a link, I run this on an iPhone simulator with Xcode 3.6.
source share