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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:23:55+00:00 2026-05-22T02:23:55+00:00

I have my coredata working fine, but when I put a setValue inside an

  • 0

I have my coredata working fine, but when I put a setValue inside an if, it doesn’t work,

this is the code>

-(void) salvalo {

StaffManagerAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSManagedObject *newDay;
newDay = [NSEntityDescription insertNewObjectForEntityForName:@"DaysAttendance"
                                       inManagedObjectContext:context];

[newDay setValue:startday forKey:@"start"];
[newDay setValue:today forKey:@"datef"];
[newDay setValue:myNumber forKey:@"empID"]; 
[newDay setValue:myNumber2 forKey:@"intID"];
//[newDay setValue:internet forKey:@"sinch"];


NSError *error;
[context save:&error];

if ([internet isEqualToString:@"YES"] ) {
    [self insertJson];

    [newDay setValue:internet forKey:@"sinch"];

}
else {
    [newDay setValue:@"NO" forKey:@"sinch"];

}



//[self.view removeFromSuperview];
[self dismissModalViewControllerAnimated:YES];


      }

please note that when I use the code inside the if in the commented part

//[newDay setValue:internet forKey:@”sinch”];

, it saves normally that value (YES/NO) to the coredata, but inside the if, it doesnt work, even if I put al the delegate and context stuff inside the if,,

so what is the problem? how to fix it?

thanks a lot!

  • 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-22T02:23:56+00:00Added an answer on May 22, 2026 at 2:23 am

    The line [context save:&error]; is before the if statements.

    You may be setting the new value properly, just not saving. The problem might just be this oversight.

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

Sidebar

Related Questions

I have setup coredata in my appDelegate, but it first loads the mainWindow.xib and
I have a sqlite DB created by my CoreData model automatically, but my app
I have created Core data app. It was working fine now it is giving
I have managed to get in app email working in my app but am
I'm working with an app using CoreData. I have a simple structure: Name Lastname
I have some Core Data functionality that was working fine until some recent (seemingly
Why isnt this working...? I have a 'Client' entity and a 'Car' entity in
I have a Core Data based mac application that is working perfectly well until
I am new on iphone development and I have problem with CoreData. I hardly
I have an application that uses CoreData. I previously had a class named Marker

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.