• 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
CFPropertyListWriteToStream and NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFPropertyListWriteToStream and NSDictionary


  • Subject: CFPropertyListWriteToStream and NSDictionary
  • From: Mike <email@hidden>
  • Date: Wed, 25 Apr 2007 21:18:12 -0700

I am ready to write my NSMutableDictionary to a stream (file) using CFPropertyListWriteToStream. However, no matter what I do, the file is created but no data is written to it.

The docs say that an NSDictionary can be passed in the CFPropertyListRef param of CFPropertyListWriteToStream, which is what I am doing. However, I still can't get a valid .plist file.

Do I need to do something to the NSDictionary data such as serializing it before I write it out?

Here is my code:

streamFileURL = CFURLCreateFromFileSystemRepresentation( kCFAllocatorDefault, (const UInt8*)"/Users/mike/test.plist", strlen( (char*)"/Users/mike/test.plist" ), false );

if( streamFileURL )
{
stream = CFWriteStreamCreateWithFile( kCFAllocatorDefault, streamFileURL );
if( stream )
{
opened = CFWriteStreamOpen( stream );
if( opened )
{
result = CFPropertyListWriteToStream( (CFPropertyListRef)loadedDockPlistDictMutable,
stream,
kCFPropertyListXMLFormat_v1_0,
NULL);
CFWriteStreamClose( stream );



Thanks,

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: CFPropertyListWriteToStream and NSDictionary
      • From: Marcel Weiher <email@hidden>
    • Re: CFPropertyListWriteToStream and NSDictionary
      • From: Dominik Pich <email@hidden>
  • Prev by Date: Re: Appending string to NSTextView crashing app
  • Next by Date: Re: Any way to find out user's default email client?
  • Previous by thread: Re: Many-To-Many Relationship Interface in Core Data
  • Next by thread: Re: CFPropertyListWriteToStream and NSDictionary
  • Index(es):
    • Date
    • Thread