I’m using CoreData and I would like to update one of attributes in one of my models, but I can’t get it to work using dot notation. My update action looks like this:
- (void)addNewsPostToFavourites:(UIButton *)sender
{
// Returns the right id.
NSLog(@"Sender tag: %d", sender.tag);
NSNumber *newsPostId = [NSNumber numberWithInt:sender.tag];
NewsPost *currentNewsPost = [NewsPost findFirstByAttribute:@"newsPostId" withValue:newsPostId];
// Doesn't seem to do anything.
currentNewsPost.favourite = @"true";
}
I have also tried [currentNewsPost setValue:@"true" forKey:@"currentNewsPost.favourite"]; but that gives me the same result, nothing happens.
I therefore wonder what I’m doing wrong.
Should also mention that I use RestKit in my project too.
Any tips would be appreciated.
You have to save your current context after your update :