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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:19:18+00:00 2026-05-31T15:19:18+00:00

When ever user search for anything like name , phone number , url, email

  • 0

When ever user search for anything like name , phone number , url, email addres then I want to search that query against address book data. My solution is working fine but it is slow . If address book data is huge , app gets stuck. How can I optimize the search , so that my application won’t hang even in large address book data?

EDIT 1 Here is my code

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{
    [self takeSomeActionWhenTextChange];  
}

-(void)takeSomeActionWhenTextChange{
    [contactArray removeAllObjects];
    NSString *searchText=[[textSearchBar text] lowercaseString];


    for (int index=0; index<count; index++) {
        ABRecordRef record=CFArrayGetValueAtIndex(people, index);
        //[self checkStringISAddress:searchText withRecord:record];
        if ([self checkStringIsFirstName:searchText withRecord:record]==YES 
        || [self checkStringIsLastName:searchText withRecord:record] == YES
        ||[self checkStringIsNote:searchText withRecord:record]==YES 
        || [self checkStringIsAddress:searchText withRecord:record]==YES 
        || [self checkStringIsCompany:searchText withRecord:record]==YES 
        ||[self checkStringIsEmail:searchText withRecord:record]
        ||[self checkStringIsPhonenumber:searchText withRecord:record]==YES )
        {
            NSLog(@"object added inside Array");
            [contactArray addObject:record];
            [contactTableView reloadData];
        }else{
            NSLog(@"No Match For this object");
            [contactTableView reloadData];

        }

    }

}

I will check if substring from search query matches with first name, last name , email & so on. Above methods contain logic to check if substring is present or not? If ti matches , i will add it to array else not.

SHOULD I USE THREAD OR GCD TO PERFOEM SEARCH ? IF YES , HOW? HOW CAN I UPDATE MY TABLE VIEW?

  • 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-31T15:19:20+00:00Added an answer on May 31, 2026 at 3:19 pm

    I have one that maybe help you

    1.Get all contacts

    NSArray *thePeoples = (NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
    

    2.Create another array(records) from the contacts array(thePeoples)

    records:{name:"abc", number:"123", url:"url", email:"email"}
    

    3.Search the mutableArray(records) with predicate

    NSPredicate * myPredicate = [NSPredicate predicateWithFormat:@"record.phoneNumber contains %@",string];
    
    NSArray * filteredArray = [records filteredArrayUsingPredicate:myPredicate];
    

    Hope it’ll help you

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

Sidebar

Related Questions

When ever user search then I want to search that query against address book
Delete some specific data present in a file.What ever user want to delete that
When ever a perform a search query i get wrong number of arguments 0
I want to have a column with checkboxes that when ever the user clicks
I have a textfield where the user can type what ever he want into
I wonder if it's ever possible to 'secure' wine; like for a user not
I have a Search box on my site and when ever the user types
Is there anything out there like Github that is for your own local server?
hi i'm using swing and in my main frame(JFrame) i want that when ever
I want to draw a circle when ever user touches any place on the

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.