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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:08:44+00:00 2026-05-31T14:08:44+00:00

I have fetching some items using CoreData and I want to filter those results

  • 0

I have fetching some items using CoreData and I want to filter those results some more using filteredArrayUsingPredicate which is giving me some issues.

CoreData Fetch:

NSFetchRequest *request = [[NSFetchRequest alloc]init];
[request setEntity:[NSEntityDescription entityForName:@"Collection" inManagedObjectContext:aContext]];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"CategoryName==%@", aCategoryName];
[request setPredicate:pred];

NSError *error=nil;
NSArray *tempArray=[aContext executeFetchRequest:request error:&error];
[request release], request = nil;

NSLog(@"results: %@", tempArray);

Which gives me this result:

results: (
    "<Collection: 0x8eb1920> (entity: Collection; id: 0x8eb0aa0 <x-coredata://7C4A4A5D-691A-4F02-9450-D0D910B53903/Collection/p95> ; data: {\n    CategoryID = 22832;\n    CategoryName = \"2000 - NOURISON 2000\";\n    IsDeleted = 0;\n    ManufacturerID = 192;\n    ModifiedOn = \"2012-03-08 09:00:46 +0000\";\n    ParentCategoryID = 0;\n    PhotoName = \"\";\n    SortOrder = 0;\n})"
)

In this instance there is only 1 result, which is not always the case so I want to filter more:

Collection *collection = [[tempArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"ManufacturerID==%@", aManufacturerID]]  lastObject];
NSLog(@"result: %@ " , collection);

Which gives me this result:

result: (null) 

Not sure what I am missing here, and I am passing the proper ManufacturerID of 192 for this filtered array 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-05-31T14:08:45+00:00Added an answer on May 31, 2026 at 2:08 pm

    What is aManufacturerID?

    By the use of the %@ format specifier it should most likely be [NSNumber numberWithInt:192]

    or if you don’t want to wrap with an NSNumber you can change the format in the predicate from %@ to %d

    NSInteger aManufacturerID = 192;
    
    Collection *collection = [[tempArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"ManufacturerID==%d", aManufacturerID]]  lastObject];
    NSLog(@"result: %@ " , collection);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried fetching MySQL query results using mysql_fetch_row() and mysql_result() and numeric values
I have a stored procedure in oracle which is using cursor.Its fetching the data
I have prepared few queries using startwith and connectby for fetching all items of
I have created an application where i am fetching some data from a webservice,which
I have a NSFetchedResultsController which is fetching objects from a NSManagedObjectContext . I'm using
I have backbone collection and under some circumstances I am fetching more models into
If I have an ajax call off fetching (with a callback) and then some
I have a NSFetchedResultsController which is fetching objects from a NSManagedObjectContext . These objects
I have an App using UITableViews and fetching data from a server. I am
I have a document generator which contains queries for about 200 items at the

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.