Это сводит меня с ума, пытаясь понять это ...
У меня есть управляемый объект, в котором мне нужно установить атрибут для пометки записи - это любимая
Проблемав том, что я не вижу значения, сохраненного в базе данных (я вытащил базу данных из симулятора и проверил ее ???)
Ниже приведен фрагмент кода ... Обратите внимание, что изсохранить
// Tell the user we have added to favorites
NSString *yes = @"Y";
[cardMessage setValue:yes forKey:@"favorite"];
NSError *error = nil;
BOOL savedSuccessfully = [managedObjectContext save:&error];
if (!savedSuccessfully)
{
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate.
You should not use this function in a shipping application, although it
may be useful during development.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Message added to Favorites" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];