I’m trying to write a file using
writeToFile:atomically:YES
However, I`m not succesful with every file. When I’m trying to write a large array (created from four parsed XML documents), the file isn’t written (it does succeed when I’m trying to write an array containing only one parsed XML). And it also work, when I’m using
writeToFile:atomically:NO
What could be the reason of this kind of a behaviour? Is there a limit for file size when using
writeToFile:atomically:YES?
The only size limit is the amount of available space on the device. However,
writeToFile:atomically:only works on an NSArray if every object, all the way down however many levels it goes, is a property list object. Property list objects areNSArray,NSDictionary,NSString,NSNumber, andNSData. Also,NSDictionaryis only a property list object if the keys are allNSString.NSArraydoes conform toNSCodingthough, so if your custom class objects also conform toNSCodingthen you could encode the array into anNSDataand write that to a file– viaNSKeyedArchiver.Alternately, clean up your data structure so you’re only using property list objects.