What does setting Core Data entity attributes to optional do?

In your tutorial you indicated that when you set an attribute of an entity as optional in the Data Model Inspector, Core Data doesn’t actually set the variable declarations as optional in the NSManagedObject subclasses. What good is setting the attributes as optional in the Data Model Inspector? Does Core Data change the way the data is saved depending on whether the attribute is set to optional in the Data Model Inspector?

If you don’t set the model attribute as being optional then you will get an exception when you try to call save() on the managed object context if you haven’t provided a value.

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.