Hi there,
I have the following problem.
I can add photos and delete photos by pressing the Visit/Unvisit button; however, when I press the Unvisit button the photo does disappear from the database, the number of photos decreases, and the photo disappears from the list of photos , BUT when the number of photos hit zero, the place still remains in the database. So I could have, for example, Amsterdam as title and 0 photos as subtitle. Shouldn't the place disappear automatically as well once the number of photos hits 0. Anyone an idea where the problem could be? I do of course use CoreDataTableViewController.[mh] and the FetchedResultsController.
Thanks
Yeah, I was thinking along those lines as well or rather I was thinking that this would be hint no. 14. I have in my removePhoto:fromVacationDocument: method the following lines of code
if (photo) {
[vacationDoc.managedObjectContext deleteObject:photo];
// Hint 14
photo.title = nil;
photo.subtitle = nil;
photo.whereTook = nil; // place is NOT removed
photo.whatsWritten = nil; // tag is removed
}
The problem is that the tag is removed when no. of photos hits 0, but the Place still remains. Just to make 100% sure, my relationships are as follows
Place <--------->>Photo<<----------->>Tag
It's quite frustrating, because everything is working as it supposed to be, except this.
You have to manually delete the place once its photo count hits zero. Same with the tags.
OK Sarah, this does the trick. I think you could be right about the reason why Core Data does not remove Place as well. Yet, I remain confused about this whole issue.
Thanks!