Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7894583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:25:56+00:00 2026-06-03T07:25:56+00:00

This code should save am uiimage to core data. The image is stored in

  • 0

This code should save am uiimage to core data. The image is stored in it’s own entity and liked to another entity (relationship)

   NSEntityDescription *imageEntity = [ NSEntityDescription insertNewObjectForEntityForName:kImage inManagedObjectContext:self.context];
    [imageEntity setValue:self.image forKey:kPicture];

    [newPerson setValue:imageEntity forKey:kPicture];

    NSError *error;
    if (![self.context save:&error]) {
        NSLog(@"Whoops, couldn't save new associate: %@", [error localizedDescription]);
    }

Here I try to get it back , to put it in an uiimageview on a custom cell

  Person *crt = [self.fetchController objectAtIndexPath:indexPath];
    cell.name.text = crt.name;
    Image *img = crt.picture;
    cell.image.image = img.picture;

This only works when the picture is first added … after restarting the app the image does not show again.. Why is that? It’s set as a transformable attribute

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:25:58+00:00Added an answer on June 3, 2026 at 7:25 am

    You can add an UIImage only as binary data. So what you need to do it set your entity’s attribute type to Binary Data, and the use the CoreGraphics' method UIImagePNGRepresentation(UIImage *image), which returns NSData and save it this way. And if you want to extract it from the database, you get the NSData and create an image with [UIimage imageWithData:(NSData *data)] method.
    But I think the best implementation is to store only the local path to the image in your database, but the actual file is stored in a folder in your app’s Documents folder… just a suggestion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this code that should help me save an image to the servers
I have this code which should create a splash image with either no animation
I'm able to save the captured image from a barcode scanner using this code:
hey there i have this code that should save a file from sql server
So I have my config file .vimrc that has this code which should save
hey, I have this code that should save a java.util.Vector of custom serializable classes:
This code should i place this code at bottom of body it's in conditional
In theory, this code should set the new lock status to the users and
So, i need to have a blinking title, this code should work, but for
The Google Analytics setup instructions state: This tracking code snippet should be included in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.