You have defined some validation rules in the xcdatamodel with the model editor: minimum/maximum values, required relationship, min/max string length.
When you insert objects via a GUI, you'll see immediate feedback when you try to create an object that fails validation. But if you create or modify an object in code, you won't see an error unless you try to save the Managed Object Context.
You can invoke -validateForUpdate: (or -validateForInsert: or -validateForDelete:) within the code that's creating your PreferenceData instance. Invoke it multiple times as you build the object, and you'll see where you're going wrong.