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

  • Home
  • SEARCH
  • 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 7714945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:15:45+00:00 2026-06-01T02:15:45+00:00

I have CoreData in my app, with an Entry class, which contains an NSOrderedSet

  • 0

I have CoreData in my app, with an Entry class, which contains an NSOrderedSet of Media classes.

I then have this code, for adding a new Media item to the NSOrderedSet:

-(void)addImage:(UIImage *)image isInPhotoLibrary:(BOOL)isInPhotoLibrary {

    Media *media = [[Media alloc] init];
    media.type = @"Image";
    media.originalImage = UIImageJPEGRepresentation(image, 1.0);
    media.isInPhotoLibrary = [NSNumber numberWithBool:isInPhotoLibrary];

    [self addMediaObject:media];

}

Will this automatically save the changes, or will I have to do it myself. If so, will i then need to pass in a context to do this, or is there another way?

  • 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-01T02:15:47+00:00Added an answer on June 1, 2026 at 2:15 am

    No it won’t.. If you want to save changes to Database in Core data you gotta call save function for that.. I assume Media is kind of NSManagedObject class. To save the changes to persistent store you have to call save method . Until then the changes are just temporary present on your scratch board/ ManagedObjectContext.

    This is how I save changes:

    Worker *worker =  (Worker *)[NSEntityDescription insertNewObjectForEntityForName:@"Worker" inManagedObjectContext:self.managedObjectContext];
    
    worker.name=txtContact.text;
    worker.address=txtAddress.text;
    worker.zipCode=txtZip.text;
    worker.city=txtCity.text;
    worker.mobile=txtMobile.text;
    
     NSError *error;
    
    if (![managedObjectContext save:&error]) 
    {
        NSLog(@"Whoops, couldn't save: %@", [error localizedDescription]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CoreData / NSPersistentDoc app. It works fine. I added a new
I have an issue with a CoreData app... it crashes on boiler plate code
I have made a new split view iPad app using CoreData. All I have
I have an app that saves data on coredata, creates an entry on the
I have a simple CoreData app which allows you to add items to a
I have a CoreData app with the MainView the UITableViewController which houses all of
This is a CoreData/SQLite app. I have 2 ways to automatically sort the data
I have a fairly simple iPhone app which utilizes CoreData for object persistence. The
I have a garbage-collected CoreData app, which is used by a few of my
I have a sqlite DB created by my CoreData model automatically, but my app

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.