• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSStrings obtained from CFStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: LaunchServices & iTunes
  • Next by Date: stringByTrimmingCharactersInSet: Bug
  • Previous by thread: LaunchServices & iTunes
  • Next by thread: Re: NSStrings obtained from CFStrings
  • Index(es):
    • Date
    • Thread