NSStrings obtained from CFStrings
NSStrings obtained from CFStrings
- Subject: NSStrings obtained from CFStrings
- From: "ROSE,ROBERT W (HP-Corvallis,ex1)" <email@hidden>
- Date: Wed, 2 Apr 2003 14:36:33 -0800
Hi all, I've got a question about retaining NSStrings that came from
CFStrings...
I'm using the XML Services API to parse an XML document. The XML document I
load into memory as an NSData *myData and then pass to
CFXMLTreeCreateFromData(... (CFDataRef) myData ... ). To get the data out
of the tree I use the CFXMLNodeGetString() function. This returns a
CFString which I immediately cast into an NSString *.
My question is, if I have a utility function that takes a CFTreeRef and
returns the NSString value of that node, what's the "kosher" way to do this?
Should I "retain" the string and then return it? Can you "retain" a
CFString? Here's what I mean:
NSString *string = (NSString *) CFXMLNodeGetString(blah);
return [[string retain] autorelease];
When the CFString comes out of CFXMLNodeGetString() what's it's refcount?
-robert rose
hp corvallis
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.