---
title: "How to use ABAddressBookRef in iOS app?"  
description: "How to use ABAddressBookRef in iOS app?"  
author: "Anonymous User"  
published: 2015-12-01  
updated: 2015-12-01  
canonical: https://www.mindstick.com/forum/33672/how-to-use-abaddressbookref-in-ios-app  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to use ABAddressBookRef in iOS app?

I am using ABAddressBookRef as a [reference](https://www.mindstick.com/forum/774/reference-what-does-this-error-mean-in-php) for my [device](https://www.mindstick.com/blog/149/retriving-network-device-information-in-c-sharp) [contacts](https://answers.mindstick.com/qa/50746/how-to-setup-your-contacts-on-your-iphone-7).\
this is my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) that I am using in our app:

```
ABAddressBookRef phoneContacts = ABAddressBookCreate();NSMutableArray *allContacts = [[[(NSArray*)ABAddressBookCopyArrayOfAllPeople (phoneContacts) autorelease] mutableCopy]autorelease];[allContacts sortUsingFunction:(int (*)(id,id,void*)) ABPersonComparePeopleByName context:(void*)ABPersonGetSortOrdering()];NSLog(@"No of Contacts:%i",[allContacts count]);for(int i=0; i<[allContacts count]; i++){  ABRecordRef person = [allContacts objectAtIndex:i];  //get phone no fill phone no into  array  ABMultiValueRef multi = ABRecordCopyValue(person, kABPersonPhoneProperty);  if(multi!=NULL && ABMultiValueGetCount(multi)>0)  {     NSLog(@"Available");  } else {     NSLog(@"Not-Available");  }}
```

But this returns 0 from [[people](https://www.mindstick.com/news/2295/more-people-need-to-monitor-this-crucial-metric-for-heart-health) [count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct)], while I have 10 contacts on my device.\
I am not [understanding](https://www.mindstick.com/articles/12918/cat-5e-vs-cat-6a-understanding-the-major-differences) what I am [missing](https://answers.mindstick.com/qa/52138/international-missing-children-s-day-2019-was-observed-on) here.\
Please help me.


---

Original Source: https://www.mindstick.com/forum/33672/how-to-use-abaddressbookref-in-ios-app

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
