I hope it's a duplicate of other links like: How to update existing object in Core Data?
But my scenario is little bit different.
The thing is I created one Sample Core Data Project.
Step 1: I have 3 ViewController classes
In 1st Screen: I created one field in core data "password" ==> I saved using code like:
NSManagedObjectContext *context = [self managedObjectContext];
// Create a new userInfo
NSManagedObject *newuserInfo = [NSEntityDescription insertNewObjectForEntityForName:@"UserInfo" inManagedObjectContext:context];
[newuserInfo setValue:self.passwordTxtFldRef.text forKey:@"password"];
NSError *error = nil;
// Save the object to persistent store
if (![context save:&error]) {
// NSLog(@"Can't Save! %@ %@", error, [error localizedDescription]);
}
In 2nd Screen: I have two textfields like: Oldpassword
& newpassword
. Here I saved old password in NSUserDefaults and in 2nd screen i checked the condition weather the oldpassword
is correct or not --> It's perfect.
Here my requirement is I want to update Oldpassword
to newpassword
---> in 2nd screen itself.
How can I do this? Can you please help me out regarding this?