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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:45:50+00:00 2026-05-26T02:45:50+00:00

I am searching an array of custom items using the following NSPredicate : NSPredicate

  • 0

I am searching an array of custom items using the following NSPredicate:

NSPredicate *query = [NSPredicate predicateWithFormat:@"[%K contains[cd] %@", column, searchString];

The array contains items of a custom class that has a number of variables (column specifies the one that is supposed to be searched). This works great for the variables that are NSStrings, however, there are some that are ints or doubles, and this code crashes when it trys to sort these. Is there any way to sort a list of ints or doubles?

  • 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-26T02:45:50+00:00Added an answer on May 26, 2026 at 2:45 am

    This works great for the variables that are NSStrings, however, there
    are some that are ints or doubles, and this code crashes when it trys
    to sort these.

    1. Post the code that fills the array.

    2. Post the crash.

    3. Post how you are trying to evaluate the predicate against the array.

    If the answer to (1) is that you are sticking ints/doubles directly into the array, that won’t work; they need to be objects. If the answer to (2) is an unrecognized selector sent to an NSNumber/NSValue class, then you need to convert the #s to strings for contains[cd] to work.

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

Sidebar

Related Questions

say, i have a string array of 50000 elements. Searching the array using For
In relation to this question i asked earlier: Searching multi-dimensional array's keys using a
I often have the need to search a javascript array that contains objects. I
I need to create an array by searching a string for occurrences of '['
I'm searching forward in an array of strings with a regex, like this: for
I'm searching the way(s) to fill an array with numbers from 0 to a
I am searching for a method to intersect my array collections. I have one
Searching here I found that this question was already asked , but I think
What is the smartest way of searching through an array of strings for a
I'm searching a possibility to get an array of elements in E4X for an

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.