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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:00:33+00:00 2026-06-12T01:00:33+00:00

Is there something wrong with the code? I can fetch nothing using this predicate.

  • 0

Is there something wrong with the code? I can fetch nothing using this predicate. Comment out the predicate then I can fetch all objects from entity “BankDetail”. So I think problem resides in these two lines.

// self.bankInfo.name is set in prepareForSegue in first view controller
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"info.name = %@",self.bankInfo.name];
[request setPredicate:predicate];

My model includes two entities, which are in one-to-one relationship

BankInfo.h

@class BankDetail;

@interface BankInfo : NSManagedObject

@property (nonatomic, retain) NSString * city;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSString * state;
@property (nonatomic, retain) BankDetail * detail;

@end

BankDetail.h

@class BankInfo;

@interface BankDetail : NSManagedObject

@property (nonatomic, retain) NSString * closeDate;
@property (nonatomic, retain) NSString * updateDate;
@property (nonatomic, retain) NSString * zip;
@property (nonatomic, retain) NSString * acquiringInstitution;
@property (nonatomic, retain) BankInfo * info;

@end

EDIT:

To provide more detail:

  • self.bankInfo.name is definitely set, I NSLog it right before the line of predicate

  • And I do this in viewDidLoad:

    NSEntityDescription *entity = [NSEntityDescription entityForName:@"BankDetail" inManagedObjectContext:context];
    NSLog(@"[entity description] is %@",[entity description]);
    

Get this in console:

info = "(<NSRelationshipDescription: 0x6d3eb30>), name info, isOptional 1, isTransient 0, entity BankDetail, renamingIdentifier info, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, destination entity BankInfo, inverseRelationship detail, minCount 1, maxCount 1, isOrdered 0, deleteRule 2";

EDIT2:
Turn out there’s nothing wrong with the predicate. The bug is caused by a careless mistake elsewhere (see the accepted answer, it’s about renaming). Please IGNORE this post if you have question about predicate.

  • 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-12T01:00:35+00:00Added an answer on June 12, 2026 at 1:00 am

    I finally fix the bug. It’s not about the predicate at all. I rename the entity from BankDetails to BankDetail in .xcdatamodeld in Xcode editor by simply hit return key and change it, like renaming any other file.

    Then I go ahead to manually rename various parts in the auto generated NSManagedObject subclass files, and in other class files that reference it, until all warnings go away. I think I have renamed all that are necessary, but I wasn’t. The program doesn’t run as I expect like I described in the question, but no error, no warning, Xcode just compile and run.

    After some time, when I finally try to regenerate the subclass files to fix the bug, the old BankDetails shows up as class name, and lots of naming errors come out. I thought it was some bug of Xcode at first. So I clean the build and regenerate subclass files again. Yet, it’s still the good old BankDetails. After a few attempts, I found the problem in Data Model Inspector (see screenshot below). Change the Class name and everything runs perfectly.

    Moral: always rename in extreme caution!

    enter image description here

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

Sidebar

Related Questions

Can anyone see if there is something wrong in my matlab code? My objective
There is something wrong with my code. I am teaching myself c# and one
My program/process exited abnormally? I doubt something is wrong with the following code: There
My UI blocked only in 4.0.* by using clause:Runtime.getRuntime().exec(cat proc/meminfo);. Is there something wrong
There is something wrong with this trigger. But what? CREATE TRIGGER MYCOOLTRIGGER AFTER INSERT
There must be something wrong. I don't know what? see this on jsfiddle .
Is there something wrong with the .dll file? Shouldn't it just consider the code
I've written a php code to display all the images. But there's is something
I wonder if there is something wrong with the copy constructor function below? class
There is probably something dumb I am doing wrong here. public function get_scores($id) {

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.