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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:37:59+00:00 2026-06-15T21:37:59+00:00

I have entity LoginPass with strings login and pass. I created registration, and now

  • 0

I have entity LoginPass with strings “login” and “pass”. I created registration, and now i need compare if text in my UItextField isEqual with one of the “login” in Core Data. And if such login is created i need compare text in password UITextField and if it’s equal, my app will open main view. I have problem with predicate and i don’t understand how i can initialise new entity with LoginPass * newEntity with using fetchResult

UPDATE: Ok, i will try to understand what i want. My English not good that’s my text isn’t correct. I have Core Data with entity “LoginPass”, consist of “login” (save nickname), “password” (save password for login) and some datas. I need check if nickname in UITextField “login” is contain in Core Data. If there are no such logins will appear alert, and if such login there in Core Data, i will check passwords, and after successful autoresation will appear main View.

//from standart singleton Appdelegate i delegated manageObjectContext
AppDelegate * appDelegate = (AppDelegate *) [[UIApplication sharedApplication]delegate];
NSManagedObjectContext *context = appDelegate.managedObjectContext;
//assigning. Can I use myEntity in my further mode of action to change datas in entity
NSEntityDescription * myEntity = [NSEntityDescription entityForName:@"LoginPass" inManagedObjectContext:context];
NSFetchRequest * fetchRequest = [[NSFetchRequest alloc]init];
//I need search in Core Data with nickname that's in UITextField "login"
NSPredicate *predicateMe = [NSPredicate predicateWithFormat:@"login==%@",login.text];
//login.text - text from UITextField, myEntity.login - string value in key "login" in COre Data
//Or i must write:
NSPredicate *predicateMe = [NSPredicate predicateWithFormat:@"%@ LIKE %@",myEntity.login,login.text];
fetchRequest.predicate = predicateMe;
[fetchRequest setEntity:myEntity];
[fetchRequest setFetchBatchSize:20];
NSSortDescriptor * sortirovka = [[NSSortDescriptor alloc] initWithKey:@"login" ascending:YES];
NSArray * sortArray = [NSArray arrayWithObjects:sortirovka,nil];
[fetchRequest setSortDescriptors:sortArray];
NSFetchedResultsController * fetchResult = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:context sectionNameKeyPath:nil cacheName:@"Login"];
//thanks for this part of code, i understand that is must be
 NSError *error = nil;
if (![fetchResults performFetch:&error]) {
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
}
//can i use myEntity for changing datas in my "LoginPass" or i need create:
LoginPass *newEntity = ?;

But I don’t understand how to create LoginPass *newEntity for changing datas for user witj nickname, entered in field “login”

  • 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-15T21:38:01+00:00Added an answer on June 15, 2026 at 9:38 pm

    Then you perform the fetch:

    NSError* error;
    if(![fetchResult performFetch  : &error])
    {
        NSLog(@"Failed with error: %@",error);
        return;  // do whatever to exit from the method (return the proper value
                 // if it doesn't return void).
    }
    NSArray* fetchedObjects=[fetchResult fetchedObjects];
    // Do this assertion if you expect that this will fetch no less
    // and no more than one object:
    NSAssert(fetchedObjects.count==1, @"Zero or too many objects"); 
    NSManagedObject* newEntity= fetchedObjects[0];
    

    I am not sure because I’ve not tested it, and I’ve not fully understood your code.But I think it should work.

    More here: NSFetchedResultsController Documentation.

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

Sidebar

Related Questions

i have an entity Entity1 that have one to many relation with Entity2 as
I have entity User with one-to-many relationship to UserToUserCategories. When I load user from
I have entity that has a version. It has composite primary key where one
Simple question. I have entity Customer in my edmx model. I need to get
I have a local list of values that I need to have entity framework
If have an entity A with a bidirectional one-or-zero-to-one mapping with entity B. The
I have entity Question . Entity Question has property Number . I need to
I have entity Ideas, which has child entity collection ChildIdeas. I need to load
I have some form, and one column have Entity type, but this entity have
I have one entity object (kind) for storing all information from user's advertisement. It

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.