0

I have iOS application which uses core data database and im using NSFetchedResultsController for populate a tableview. Im using entity named "Catalog" to populate tablview and i have thumbnail image stored in entity Named "Image" and i store image as NSData in a property of image entity, im updating that thumbnail image after populating the tableview but any of bellow methods not called.

  • (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
  • (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath
  • (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id )sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
  • (void)controllerDidChangeContent:(NSFetchedResultsController *)controller

  • But when i change a properties of "Catalog" entity itself those methods called.

Informations of My Entities

Catalog(Entity)

Attributes

title <= String nid <= String (my primary key field) some few attributes

Relationships

Relationship :thumbImage, Destination :Image, Inverse :catalog,

Image(Entity)

Attributes fid <= String (my primary key field), image <= Image Data field

Relationships

Relationship :catalog, Destination :Catalog, Inverse :thumbImage

3
  • Have u set the delegate? e.g typically like this _fetchedResultsController.delegate = self; May 7, 2013 at 7:32
  • 1
    yes i have set delegate, Delegate methods are called if when change of a attributes of catalog entity problem with changing relationship's attribute. May 7, 2013 at 7:37
  • That is a known restriction of NSFetchedResultsController, compare stackoverflow.com/questions/7533849/….
    – Martin R
    May 7, 2013 at 7:46

1 Answer 1

0

try adding this to your Image entity:

//Not tested
- (void) setImage:(NSData *)data
{
    [self.catalog willChangeValueForKey:@"thumbImage"]
    [self willChangeValueForKey:@"image"];
    [self setPrimitiveValue:data forKey:@"image"];
    [self didChangeValueForKey:@"image"];
    [self.catalog didChangeValueForKey:@"thumbImage"];
}
3
  • The lines: [self.catalog willChangeValueForKey:@"thumbImage"];,[self.catalog didChangeValueForKey:@"thumbImage"]; not calls to NSFetchedResultsControllerDelegate. help please!
    – evya
    Oct 8, 2013 at 10:20
  • if this does not work, try adding an integer property to Catalog and increment it then the image change content (sort of 'needRefresh' property)
    – Dan Shelly
    Oct 9, 2013 at 7:28
  • 1
    I can't test this at the moment. will try to get back to you when I'll have more time.
    – Dan Shelly
    Oct 9, 2013 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.