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

  • Home
  • SEARCH
  • 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 6771499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:26:22+00:00 2026-05-26T15:26:22+00:00

It raises an exception when I enter more than two characters in the searchfield.

  • 0

It raises an exception when I enter more than two characters in the searchfield. I use NSComparisonResult to show results on a UITableView:

- (void)filterContentForSearchText:(NSString*)searchText
{

for (mystring in self.array)
{

NSComparisonResult result = [mystring compare:searchText options:(NSCaseInsensitiveSearch) 
range:NSMakeRange(0, [searchText length])];

if (result == NSOrderedSame)
        {   
            NSUInteger index=[self.array indexOfObjectIdenticalTo:mystring]; 
            NSUInteger maxindex = index + 50;
            for (index ; (index < [self.array count] && index <= maxindex && index!= NSNotFound); index ++)
            {   
                [self.filteredListContent addObject:[NSDictionary dictionaryWithObjectsAndKeys:[self.array objectAtIndex:index],@"english",[self.secondarray objectAtIndex:index],@"translated",nil]];  
            }
            break;
        }
}

The output shows:

 -[UIDeviceWhiteColor compare:options:range:]: unrecognized selector sent to instance 0x5e4a5d0
2011-11-06 12:10:51.932 XXX[2583:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceWhiteColor compare:options:range:]: unrecognized selector sent to instance 0x5e4a5d0'

What does UIDeviceWhiteColor in this case mean?


self.array = [[NSArray alloc] initWithArray:
           [[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"first" ofType:@"txt"]
                                      encoding:NSUTF8StringEncoding error:NULL] componentsSeparatedByString:@"\n"]];

self.secondarray = [[NSArray alloc] initWithArray:
           [[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"second" ofType:@"txt"]
                                      encoding:NSUTF8StringEncoding error:NULL] componentsSeparatedByString:@"\n"]];
  • 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-26T15:26:23+00:00Added an answer on May 26, 2026 at 3:26 pm

    That’s because there is a UIDeviceWhiteColor somewhere in your self.array, which should be made of just NSStrings. How do you populate this array?

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

Sidebar

Related Questions

Is there a way of doing a find_by_x that raises an exception if the
I'm familiar with the following: If the operation raises an exception that your code
how can I print the full call stack when a std::exception raises?
Python 2.5 won't let me use this syntax: try: code_that_raises_exception() except Exception as e:
Given the following situation: @try { @try { // raises an exception :) [receiver
I don't understand why the following raises an exception: class X def to_s x
Here's the code that raises the exception public Configuration GetConfiguration() { var persister =
I want to use Oracle exception to handle errors that might happen in the
I need raise an exception from C++ code. Raised exception must contain text and
I am facing the dreaded Unhandled Exception raised by Flup. The sad part is

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.