A Boolean value that indicates whether the context has uncommitted changes.
SDKs
- iOS 3.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Data
Declaration
@property(nonatomic, readonly) BOOL hasChanges;
Discussion
If you are observing this property using key-value observing (KVO) you should not touch the context or its objects within your implementation of observe
for this notification. (This is because of the intricacy of the locations of the KVO notifications—for example, the context may be in the middle of an undo operation, or repairing a merge conflict.) If you need to send messages to the context or change any of its managed objects as a result of a change to the value of has
, you must do so after the call stack unwinds (typically using perform
or a similar method).
Special Considerations
In macOS 10.6 and later, this property is Key-value observing compliant.