FROM : Mike
DATE : Thu Apr 26 22:36:22 2007
I ended up doing that after having to do a lot of hacking on the
NSDictionary and now it works.
Thanks,
Mike
Marcel Weiher wrote:
>
> On 25,Apr 2007, at 21:18 , Mike wrote:
>
>> I am ready to write my NSMutableDictionary to a stream (file) using
>> CFPropertyListWriteToStream.
>
> Why?
>
> Why not just use
>
> [loadedDockPlistDictMutable writeToFile:@"/Users/mike/test.plist"
> atomically:YES];
>
> ?
>
> Cheers,
>
> Marcel
>
>
>
>> 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_removed>)
>>
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>
>
>
DATE : Thu Apr 26 22:36:22 2007
I ended up doing that after having to do a lot of hacking on the
NSDictionary and now it works.
Thanks,
Mike
Marcel Weiher wrote:
>
> On 25,Apr 2007, at 21:18 , Mike wrote:
>
>> I am ready to write my NSMutableDictionary to a stream (file) using
>> CFPropertyListWriteToStream.
>
> Why?
>
> Why not just use
>
> [loadedDockPlistDictMutable writeToFile:@"/Users/mike/test.plist"
> atomically:YES];
>
> ?
>
> Cheers,
>
> Marcel
>
>
>
>> 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_removed>)
>>
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>
>
>
| Related mails | Author | Date |
|---|---|---|
| Mike | Apr 26, 06:18 | |
| Dominik Pich | Apr 26, 21:10 | |
| Marcel Weiher | Apr 26, 22:23 | |
| Mike | Apr 26, 22:36 |






Cocoa mail archive

