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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:17:39+00:00 2026-05-22T00:17:39+00:00

A very specific question, so doing research on it is kind of hard. It

  • 0

A very specific question, so doing research on it is kind of hard. It seems pretty straightforward to me, but I’m doing something wrong and I can’t see what it is.

I’ve created the following method:

- (NSComparisonResult) searchBuildingObject:(NSDictionary *) building forString:(NSString *) searchString {

    NSComparisonResult buildingComparison = [[building objectForKey:@"building"] compare:searchString
                                                                                 options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)
                                                                                   range:NSMakeRange(0, [searchString length])];

    if (buildingComparison != NSOrderedSame) {

        for (NSString *alias in [building objectForKey:@"alias"]) {

            NSComparisonResult aliasComparison = [alias compare:searchString
                                                        options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)
                                                          range:NSMakeRange(0, [searchString length])];

            if (aliasComparison == NSOrderedSame)
                return aliasComparison;
        }
    }

    return buildingComparison;

}

It seems to be working fine, even when I test the method it gives me the correct results. Yet, I still get a warning upon calling the method:

[self searchBuildingObject:[self.buildings objectForKey:building] forString:searchText]

I made sure building is an NSDictionary, and searchString is definitely an NSString. The result of the method is an NSComparisonResult which I then compare to NSOrderedSame

NSComparisonResult result = [self searchBuildingObject:[self.buildings objectForKey:building] forString:searchText];
if (result == NSOrderedSame) NSLog(@"Same");

The warning I’m getting is “BuildingsViewController may not respond to ‘-searchBuildingObject:forString:’. Does anybody see what’s wrong?

  • 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-22T00:17:40+00:00Added an answer on May 22, 2026 at 12:17 am

    That warning usually indicates that you have forgotten to declare the method in the interface of the referred-to object:

    @interface BuildingsViewController : ControllerSuperclass {
           // Declaration of ivars...
    }
    
    - (NSComparisonResult) searchBuildingObject:(NSDictionary *) building forString:(NSString *) searchString;
    // Other method declarations...
    
    @end
    

    The reason it’s a warning and not an error is that it’s the compiler complaining that it’s not certain that you can call that method on that object. The @interface declaration is what the compiler looks at to make that determination.

    The compiler also knows about methods which were not declared, but which are defined before you call them (this only applies within a single compilation unit — loosely speaking, a class can call its own method which doesn’t have a declaration, without the compiler complaining, if the method’s implementation is located previous to its use in the file; not a great thing to rely on).

    The method lookup/resolution is done later, at runtime, and the compiler doesn’t know about that. Because the method does actually exist on your class, the call succeeds at that time.

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

Sidebar

Related Questions

This is a very narrow and specific question, but I know there are someone
This question might seem very specific but I am in need of some ideas
This question is kind of general and not very specific. We have a java
A very specific question from a novice to TDD : I separate my tests
This is a very specific question which will probably earn me the tumbleweed badge,
This is a very specific question for a Google Chrome extension. http://www.meebo.com/mobile/ This page
First of I'm very sorry but this questions is not so so specific. All
I know there is this question that is very similar, but I wanted to
Okay, this is (probably) a very simple question, but I am afraid I know
This question might appear very simple, but i haven't found an answer yet, so

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.