Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dictionary won't write to disk



Off the top of my head - are you sure you really have a dictionary and not nil?  

What you're describing sounds like what happens when you keep throwing messages at nil - which is  to say - nothing is happening and it looks somewhat like an empty dictionary.

On Jun 8, 2005, at 6:49 PM, Dave DeLong wrote:

Hi Everyone,

I'm writing a program that has me dealing with dictionaries that contain thousands of K/V pairs.  As I was working along, I came across a manipulation of one of my dictionaries that was coming back empty, which it shouldn't be.

So I decided to try and write my main dictionary to disk so I could inspect the structure to make sure everything was ok.  (NSLog([myDictionary description]) would be horribly impractical -- my dictionary has 3300+ entries, each of which is another dictionary with about 20 entries)

So I put in the line:

if ([myDictionary writeToFile:[@"~/Desktop/Songs.xml" stringByExpandingTildeInPath] atomically:NO]) {}

Unfortunately, nothing is happening!  I've tried many different things like changing "atomically" to YES, putting it into a brand new dictionary via:

NSDictionary *temp = [[NSDictionary alloc] initWithDictionary:myDictionary copyItems:YES];

and then trying to write THAT dictionary.  I've also tried using writeToURL and also taking it out of the if() statement, but nothing works.

The only idea I have is that my huge 2D enumeration shortly thereafter is clogging up the computer somehow so that it can't be written (enumerate through an NSArray, each object of which has an NSArray that I enumerate through).

Any ideas on how I can dump my dictionary to a file?

Thanks!

Dave
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Dictionary won't write to disk (From: Dave DeLong <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.