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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:04:20+00:00 2026-05-29T09:04:20+00:00

I have several problems relating to NSPredicates, here are they; 1.) My code is

  • 0

I have several problems relating to NSPredicates, here are they;

1.) My code is as follows;

 NSArray *arr= [self.humanArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"ANY name IN %@ ", nameArray]];

I get the following exception;

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The left hand side for an ALL or ANY operator must be either an NSArray or an NSSet.'

*** Call stack at first throw:

When i write the predicate as @"name IN %@ ", nameArray. It works, but i think there might be some underneath flaw in this.

note: the humanArray, contains objects of HUMAN, and an object of human contains the following attributes. name, age, gender, country, region.

2.) I think what i am doing here, is wrong. The user is given the option to filter the self.humanArray. The user may filter using one, more or none of the following criteria;

name, age, gender, country or region.

My code looks like this;

 NSArray *fRegionArray= [self.humanArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"regionIN %@ ", regionArray]];



 NSArray *fCountryArray= [fRegionArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"country IN %@ ", countryArray]];



 NSArray *fNameArray= [fCountryArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"name IN %@ ", nameArray]];

This code works, if the user selects all the filter attributes (region, country and name). If you look at the above code you will notice that the output array of the 1st predicate is used for filtering in the 2nd predicate. So that is the reason for it to behave this way.

I need to modify the above code, so that the user would enter any of the attributes for filtering purposes. region or country or name.

  • 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-29T09:04:21+00:00Added an answer on May 29, 2026 at 9:04 am
    1. foo IN already means any object foo in said array. You’d use ANY followed by a basic expression (example ANY objects.value < 13). IN is an aggregate expression.
    2. You could use a temporary value and filter it only by attributes actually used?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I normally have several problems with how cron executes scripts as they normally don't
While trying to use LINQ to SQL I encountered several problems. I have table
I've worked on several PHP projects and always I have problems with organizing my
I have a rather large legacy Java Applet that has several problems: It looks
I'm trying to figure this out and having problems. I have several projects (not
We have had several problems with being hacked. We currently have all the config
I'm starting to learn how to use CMake, but I have had several problems
I load a swf into a movie clip and have several problems with it:
Maybe I misunderstood this but from what I read I may have several problems
I'm new to iPhone dev and Obj-C and I have several problems with ScrollView/ImageView

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.