views:

100

answers:

1

Is there a size limit to saving dictionaries?

I am attempting to write a rather large dictionary with around 100 keys with nested dictionaries using writeToFile: but it never writes and is always false.

Is this a limitation or am I doing something incorrect,

The code i use is the following.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
NSString *fullPath = [documentsDir stringByAppendingPathComponent:@"test.plist"];   

[myDict writeToFile: fullPath  atomically:YES];
+4  A: 

There is no size limit (save for memory and disk space).

What are the contents of myDict?

If it is anything but the small set of classes allowed in property lists, then you can't use writeToFile:atomically:.

Either you would need to limit your dictionary to only containing instances of those classes or you will need to use a different archiving method.

Of relevance:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Archiving.html#//apple_ref/doc/uid/10000047i

bbum