NSUserDefaults claims to be limited to 4194304 bytes in Catalina

Number:rdar://FB7635020 Date Originated:Mar 21, 2020 at 7:36 PM
Status: Resolved:
Product:AppKit Product Version:
Classification: Reproducible:
starting with macOS Catalina 10.15.0, every attempt to store more than 4MB using NSUserDefaults results in the following message:

[User Defaults] CFPrefsPlistSource<0x600002c00c00> (Domain: com.corecode.AppTemplate, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): Attempting to store >= 4194304 bytes of data in CFPreferences/NSUserDefaults on this platform is invalid. This is a bug in AppTemplate or a library it uses

this message is VERY misleading since actually storing more than 4MB (and retrieving it afterwards) works just fine.

since this 'limitation' hasn't been mentioned anywhere in the release-notes for Catalina, it is completely unclear whether this message really refers to the fact that storing more than 4MB in NSUserDefaults is going to be deprecated or whether this message just occurs because of a bug in your implementation.

if there is no intent on limiting NSUserDefaults to 4MB, please remove this message.

if there is intent to limit NSUserDefaults to 4MB, please properly document this in your documentation and release-notes.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!