 <p>Just commented the line</p> <pre><code>CFIndex n = ABAddressBookGetPersonCount(addressBook); </code></pre> <p>And replaced with this to get total number of records</p> <pre><code>CFIndex n = CFArrayGetCount(all); </code></pre> <p>Because the count is different for all(Array) and for the variable n. </p> <p>Hope this will help others too.</p>