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 6778911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:19:21+00:00 2026-05-26T16:19:21+00:00

Im trying to insert values in a core data entity, but when I try

  • 0

Im trying to insert values in a core data entity, but when I try to insert in a Relationship field it crash

NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
        NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
        NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:      [entity name] inManagedObjectContext:context];
        [newManagedObject setValue:[NSDate date] forKey:@"fechaAprovacion"];
        [newManagedObject setValue:[NSDate date] forKey:@"fechaUltimoOficio"];
 //relationship field----->[newManagedObject setValue:[NSNumber numberWithInteger:self.index.row] forKey:@"vObra"]; //<---relationship field

        // Save the context.
        NSError *error = nil;
        if (![context save:&error]) { 
            NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
            abort();
        }
  • 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-05-26T16:19:22+00:00Added an answer on May 26, 2026 at 4:19 pm

    I solve it!! i just have to insert the NSManagedObject that is related some thing like this

    NSManagedObject *reporteManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"Reporte" inManagedObjectContext:self.managedObjectContext];
    
    NSManagedObject *partidaManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"Avance" inManagedObjectContext:self.managedObjectContext];
    
    [partidaManagedObject setValue:reporteManagedObject forKey:@"avanceReporte"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert some values on a data base, but it doesn't work
I'm trying to insert values in the table but when I click on the
I am trying to insert all values of one table into another. But the
I am trying to insert values into selected columns of table, but only insert
I am trying to insert values in database and values are not being inserted,
I am trying to insert certain values into the table using SQL server 2005.
im trying to insert this query with mysql_query INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)
I am trying to insert a time only value, but get the following error
I'm trying to cache a price value using HttpRuntime.Cache.Insert(), but only appears to hold
I am trying to insert a value to a SQLite db, but everytime I

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.