Alterplay / APAddressBook

Easy access to iOS address book
MIT License
1.38k stars 193 forks source link

filter by phoneNumber #134

Closed mkaya93 closed 8 years ago

mkaya93 commented 8 years ago

Hi,

I'm trying to filter contacts by phone number. Which method should I use for this.

Thanks

belkevich commented 8 years ago

Hi,

How exactly you want to filter contacts? Do you want to remove contacts without phone number?

mkaya93 commented 8 years ago

No I just want to find contact with phone number. So How can I do that ?

belkevich commented 8 years ago
addressBook.filterBlock = ^BOOL(APContact *contact)
{
    for (APPhone *phone in contact.phones)
    {
        if ([phone.number isEqualToString:@"1234567890"])
        {
            return YES;
        }
    }
    return NO;
};
belkevich commented 8 years ago

Does it helps?

mkaya93 commented 8 years ago

Actually now its crashing on some contacts which is not have phone numbers. I'm trying to solve it

belkevich commented 8 years ago

Ok, feel free to reopen this issue if you need it