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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:03:51+00:00 2026-06-18T05:03:51+00:00

My Search Bar works in console but in the simulator doesn’t work and i

  • 0

My Search Bar works in console but in the simulator doesn’t work and i don’t know why.
I have tried with many codes but nothing works. I’m looking for restaurant names in my tableview but when i type nothing happen, everything stays equal in the simulator.

This is my code:

-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{
    if([searchText length] == 0){
        [jsonObject2 removeAllObjects];
        [jsonObject2 addObjectsFromArray:jsonObject];
    }else{
        [jsonObject2 removeAllObjects];

        for(NSDictionary *dictionary in jsonObject)
        {
            NSObject *ob = [dictionary objectForKey:@"nombres"];
            if([ob isKindOfClass: [NSString class]])
            {
                NSString*string=[ob description];
                NSRange range = [string rangeOfString:searchText options:NSCaseInsensitiveSearch];

                if (range.location != NSNotFound) {
                    [jsonObject2 addObject:ob];
                    NSLog(@"%@",jsonObject2);
                }
            }
        }
    }
    [myTableView reloadData];
}

-(void)searchBarSearchButtonClicked:(UISearchBar *)asearchBar{
    [searchBar resignFirstResponder];
}
  • 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-06-18T05:03:52+00:00Added an answer on June 18, 2026 at 5:03 am

    There may be two reasons for this issue

    1. You are using jsonObject as your data source of table view. If so use jsonObject2.

    2. If first case is wrong then may be you should log your jsonObject2 after all search component are added in that. And fix that in case it doesn’t string objects in it.

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

Sidebar

Related Questions

I have a UITableView that has a Search Bar. Everything works fine but when
I have a UI table view with a search bar and it works well
On my website I have a search-bar. It works as a form that submits
I have implemented a UITableView with search bar (and search display) - all works
I have a table view set up with a search bar. Everything works great:
On the website I'm building for work, we have a search bar where the
I have a tableview that filters based on a search bar. This works well
This code works, hide the search bar if less than ten items, but I
I have a search bar positioned above a tableview. The search functionality works great.
I am trying to get the 'Search Bar and Display Controller' functionality to work

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.