---
title: "How to type-cast ABRecordRef into NSNumber in iOS"  
description: "How to type-cast ABRecordRef into NSNumber in iOS"  
author: "Anurag Sharma"  
published: 2015-12-02  
updated: 2015-12-06  
canonical: https://www.mindstick.com/forum/33674/how-to-type-cast-abrecordref-into-nsnumber-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to type-cast ABRecordRef into NSNumber in iOS

I have successfully get [device](https://www.mindstick.com/blog/149/retriving-network-device-information-in-c-sharp) contact ID using this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):\

```
ABRecordRef contactPerson = (__bridge ABRecordRef) allContacts[i];
```

but [now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) my problem is how can I type-[cast](https://answers.mindstick.com/qa/97273/how-to-cast-a-baitcaster) ABRecordRef [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) into NSNumber.\
How can I [solve this problem](https://answers.mindstick.com/qa/94681/my-google-assistant-shows-completely-different-search-results-from-what-i-ask-how-can-i-solve-this-problem).\
\

## Replies

### Reply by Tarun Kumar

First of all, the code you are specifying here,

```
ABRecordRef contactPerson = (__bridge ABRecordRef) allContacts[i];
```

this code is used for fetching person contacts one by one.\

after that we we will get Id of that person using contactPerson. Here I am providing that code which will fetch Id and type-cast into NSNumber:

```
NSNumber *contactId = [NSNumber numberWithInt:ABRecordGetRecordID(contactPerson)];
```


---

Original Source: https://www.mindstick.com/forum/33674/how-to-type-cast-abrecordref-into-nsnumber-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
