Your solution works and you have the approach correct. Core Data will not automatically delete a dangling child. You will need to explicitly delete it. However, the "where" comes into question.
If you really always want to delete the existing child before adding a new one like this then I would handle it in the subclass of the parent object in the set accessor. This will allow you to check for equality, etc. before performing the delete. That would also remove this maintenance work from your (presumably) view controller.
Update
OK, thanks. So I should create a custom setter with setPrimitiveValue & friends?
Correct. You will also want to have the KVO methods in place as well (-willChangeValueForKey:
and -didChangeValueForKey:
) so that your accessor is doing the right thing.