Is there any reason why storing a NSData object of say ~50MB into NSUserDefaults might be a bad idea?
There’s nothing about it in the documentation, but whenever I see NSUserDefaults being used, it’s usually for fairly small amounts of data. I figure storing in NSUserDefaults is simpler than storing in a file though, so I would like to use it if possible.
As NSUserDefaults stores objects as property lists, so there’s the possibility that it will use a text (XML)-format plist and not a binary one. In this case, NSData will send ints description into the file, which is 2 times bigger than its real size, as it, in fact, is the hexadecimal representation of the data (plus space padding, etc…)
It’s conceptually misused/abused then. User defaults are, well, the user’s defaults. That is, they should be used to store preferences/settings, not whole files. That is the task of file handling APIs (C stdio functions, NSFileHandle, etc…)
Hope this helps.