Search code examples
iosobjective-ccore-datansdatansfetchedresultscontroller

Why am I able to access all of the attributes from Core Data except the image attribute? (Which is binary data?)


I do the following in heightForRowAtIndexPath::

Post *post = [self.fetchedResultsController objectAtIndexPath:indexPath];

Anywhere I then try to use post.image it says that the image property doesn't exist. But I can do post.title very easily. I've performed a "Clean" and a "Clean Build Folder" and restarted Xcode.

image is definitely in the Core Data xcdatamodeld file and this is the information when I select it:

enter image description here

Why am I unable to access it?


Solution

  • Make sure this is in your Post.h:

    @property (nonatomic, retain) UIImage * image;
    

    and your Post.m

    @dynamic image;
    

    See this post for convenient automatic conversions.