Hi,
I have a Core Data model with 2 entities: Game and ScoreTable. A Game has an optional relationship with ScoreTable. I usually check if a game has a ScoreTable by doing:
NSManagedObject *scoreTable = [myGame valueForKey: @"scoreTable"];
if (scoreTable == nil) {
// wtv
}
And when I want to delete a ScoreTable from a Game I'll just
[context deleteObject: scoreTable];
But the next time I check if the scoreTable == nil, it seems that it "stopped" being nil, as if there's something there, but empty, or something. So, what I'm doing is:
[myGame setValue: nil forKey: @"scoreTable"];
Somehow this doesn't feel right. Or does it? I'm not sure if I should check if the scoreTable == nil. Is there another way of checking if there is an object there?